Return-Path: X-Original-To: apmail-brooklyn-dev-archive@minotaur.apache.org Delivered-To: apmail-brooklyn-dev-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 50A4E18934 for ; Mon, 20 Jul 2015 18:14:44 +0000 (UTC) Received: (qmail 4434 invoked by uid 500); 20 Jul 2015 18:14:44 -0000 Delivered-To: apmail-brooklyn-dev-archive@brooklyn.apache.org Received: (qmail 4399 invoked by uid 500); 20 Jul 2015 18:14:44 -0000 Mailing-List: contact dev-help@brooklyn.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@brooklyn.incubator.apache.org Delivered-To: mailing list dev@brooklyn.incubator.apache.org Received: (qmail 4385 invoked by uid 99); 20 Jul 2015 18:14:43 -0000 Received: from Unknown (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 20 Jul 2015 18:14:43 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id 1A4AC1A74E0 for ; Mon, 20 Jul 2015 18:13:25 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 2.901 X-Spam-Level: ** X-Spam-Status: No, score=2.901 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=3, URIBL_BLOCKED=0.001] autolearn=disabled Authentication-Results: spamd2-us-west.apache.org (amavisd-new); dkim=pass (1024-bit key) header.d=cloudsoftcorp.com Received: from mx1-us-west.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id ne3_ix7uRmze for ; Mon, 20 Jul 2015 18:13:12 +0000 (UTC) Received: from mail-wg0-f48.google.com (mail-wg0-f48.google.com [74.125.82.48]) by mx1-us-west.apache.org (ASF Mail Server at mx1-us-west.apache.org) with ESMTPS id 1CECA2164D for ; Mon, 20 Jul 2015 18:13:12 +0000 (UTC) Received: by wgmn9 with SMTP id n9so137093165wgm.0 for ; Mon, 20 Jul 2015 11:13:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cloudsoftcorp.com; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=cT3RuonKLKatmLAEFzS6E8hi18KvEeC4AbzVr8+JZQ8=; b=KM9KKvqtukdv6KXEfAmKehA2ATPhFVr2dPZjwGx5dNhQCwb4Ruzm3kVloF2s1tiDXf SOI7e0X/xIGzRJf6jr130pS3EOAlYOfBTwq1Oeqs9jhuFH4sTokBgySz959UnA9XCosC AZGrxl0kjIRUR2qDlRzSTu1LJoZjscpbvEJLY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:content-type; bh=cT3RuonKLKatmLAEFzS6E8hi18KvEeC4AbzVr8+JZQ8=; b=gnjBQiYCTQ70yZQVCjoE2Er0e3LuteYbxi33sYvzPkMVvdOJBQBQaNKUpqzHUXq+tM Y0sbfpX0PlOz9ddGiK/9AMve2zxk45AGbOtgh03yj7GE1hByhD88fSjAKu04IxBvG7a0 kIbtk7WYOV1f1A2DLHoEDPa4yWObv9P71TyWXQlZm21eIpSrsXp0oirSp58n7pQYwNDT LXDSQ8sbPH9IY0pts8yzovuiQJKbCPNRwX8RqDbh87UkNxtCnuzec2wPhqd+MyV3jjMj 57gLyTqZ9prB8oDUeohmrPyR8Mis7jRbGJ70wX5yFTSis3pnDm7ii7qpzKC2CEWkhX56 QLaw== X-Gm-Message-State: ALoCoQlUOpQSfzRZeTEQ9DKsTiqd5EJLFELS5DFw3X3vngp1mNSjaVY44WSiof19JCP9Ea0i6BRRA/ziiDh93NCocPKy9wp35KEGpyF8hRJYbs+tbk13BfEMhgg7lcwU/AZRrik0gh0Udu/FykrvvrGZEXOvSubxsA== X-Received: by 10.194.109.229 with SMTP id hv5mr62512817wjb.119.1437415990744; Mon, 20 Jul 2015 11:13:10 -0700 (PDT) MIME-Version: 1.0 Received: by 10.27.45.133 with HTTP; Mon, 20 Jul 2015 11:12:51 -0700 (PDT) In-Reply-To: <4392395B0F14A447BEC2368828073C1CF051E91A@USVIESVREXP02.virtustream.local> References: <4392395B0F14A447BEC2368828073C1CF051E91A@USVIESVREXP02.virtustream.local> From: Sam Corbett Date: Mon, 20 Jul 2015 19:12:51 +0100 Message-ID: Subject: Re: Startable entity does not get "on fire" if exception is thrown within start() To: dev@brooklyn.incubator.apache.org Content-Type: multipart/alternative; boundary=047d7b60441a85f649051b527d6c --047d7b60441a85f649051b527d6c Content-Type: text/plain; charset=UTF-8 Hi Michael, Question 1: I agree with you that this behaviour is surprising. I'm going to guess that you are using BasicStartableImpl. Its implementation of `start` should be modified to follow the same pattern as entities that extend `brooklyn.entity.basic.SoftwareProcess`, which defers to a class called MachineLifecycleEffectorTasks. This class' `start` method transitions through "starting" and "started" states. If an exception is thrown it sets the entity "on fire" and before propagating the exception. See this link for the implementation: https://github.com/apache/incubator-brooklyn/blob/d7ac3ac11d70b0ba1b6e3f5d7cbcd5d1615bbd33/software/base/src/main/java/brooklyn/entity/software/MachineLifecycleEffectorTasks.java#L232-242 Question 2: To set the state of an entity you should follow pattern shown in the link above. For example, to have an entity set itself "on fire": ServiceStateLogic.setExpectedState(this, Lifecycle.ON_FIRE); The value of using this indirection (rather than directly calling `entity.setAttribute(Attributes.SERVICE_STATE_ACTUAL, Lifecycle.ON_FIRE)`) is that it will track metadata around state transitions like the date and time they occur. I will look at updating BasicStartableImpl. I hope this helps, Sam On 2 July 2015 at 15:40, Michael Schneider < Michael.Schneider@virtustream.com> wrote: > Hi! > > I have a Startable entity. I have found that if an exception is thrown > within the start() method, the entity still gets green at the end. > > Question 1: Is this intended behavior, and if so, why? > > Question 2: What options do I have to force the entity into state "on > fire" if any unhandled exception is thrown in start()? > > Regards, > Michael > > Michael Schneider > Senior Software Engineer > > Virtustream Inc. > 6 Concourse Parkway | Suite 1930 | Atlanta | GA 30328 > Cell: +49 (176) 24102310 > michael.schneider@virtustream.com > | www.virtustream.com > > Keep up with Virtustream: > Blog * Twitter< > https://twitter.com/#%21/virtustream> * LinkedIn< > http://www.linkedin.com/company/virtustream> * Slideshare< > http://www.slideshare.net/Virtustream> * YouTube< > http://www.youtube.com/user/Virtustream> > > The information contained in this electronic mail transmission may be > privileged and confidential, and therefore, protected from disclosure. If > you have received this communication in error, please notify us immediately > by replying to this message and deleting the email and its attachments from > all computers without copying or disclosing it. > -- Cloudsoft Corporation Limited, Registered in Scotland No: SC349230. Registered Office: 13 Dryden Place, Edinburgh, EH9 1RP This e-mail message is confidential and for use by the addressee only. If the message is received by anyone other than the addressee, please return the message to the sender by replying to it and then delete the message from your computer. Internet e-mails are not necessarily secure. Cloudsoft Corporation Limited does not accept responsibility for changes made to this message after it was sent. Whilst all reasonable care has been taken to avoid the transmission of viruses, it is the responsibility of the recipient to ensure that the onward transmission, opening or use of this message and any attachments will not adversely affect its systems or data. No responsibility is accepted by Cloudsoft Corporation Limited in this regard and the recipient should carry out such virus and other checks as it considers appropriate. --047d7b60441a85f649051b527d6c--