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 < [email protected]> 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 > [email protected]<mailto:[email protected]> > | www.virtustream.com<http://www.virtustream.com/> > > Keep up with Virtustream: > Blog<http://www.virtustream.com/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.
