Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 3C264200C3F for ; Wed, 22 Mar 2017 21:17:33 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 3764A160B86; Wed, 22 Mar 2017 20:17:33 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 588FD160B74 for ; Wed, 22 Mar 2017 21:17:32 +0100 (CET) Received: (qmail 46294 invoked by uid 500); 22 Mar 2017 20:17:31 -0000 Mailing-List: contact dev-help@brooklyn.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@brooklyn.apache.org Delivered-To: mailing list dev@brooklyn.apache.org Received: (qmail 46282 invoked by uid 99); 22 Mar 2017 20:17:30 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 22 Mar 2017 20:17:30 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 66910C11AB for ; Wed, 22 Mar 2017 20:17:30 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -0.121 X-Spam-Level: X-Spam-Status: No, score=-0.121 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd1-us-west.apache.org (amavisd-new); dkim=pass (1024-bit key) header.d=cloudsoftcorp.com Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id EwMeber0AkFX for ; Wed, 22 Mar 2017 20:17:29 +0000 (UTC) Received: from mail-wm0-f41.google.com (mail-wm0-f41.google.com [74.125.82.41]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTPS id 54A225F2F1 for ; Wed, 22 Mar 2017 20:17:29 +0000 (UTC) Received: by mail-wm0-f41.google.com with SMTP id w204so2003932wmd.1 for ; Wed, 22 Mar 2017 13:17:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cloudsoftcorp.com; s=google; h=from:content-transfer-encoding:mime-version:subject:date:references :to:in-reply-to:message-id; bh=w+wRHpdBLzfVlGtsSkVlk6nu4mYvrzFzkp/A7rFajPc=; b=RQU3A8GuN9HEtnhvPMzfzUsPClWpk80dHe7PzCK9NCIOjrzfX660/GTCIYbj2pUx6N Ny3qtYzo5rBPQ452+lQ9+ZvRbHnlj8YqNWjt/hAn+N3ojTsy6HaIb+l+80Gmgqggy45D 6/+OyHSlWFySSC2AUydlDixmb+XBdhqFp2Lu8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:content-transfer-encoding:mime-version :subject:date:references:to:in-reply-to:message-id; bh=w+wRHpdBLzfVlGtsSkVlk6nu4mYvrzFzkp/A7rFajPc=; b=AOdjpUBqPPefhIRlSO63Sw1hLfN7QBZglTbZyQT6DT42JbNGowJWhOyLwWUi0CjvuX 53eVcf1wzNRHp9CU9Csr3U5whPmnIpgdaNM9DeuXhUQJM41yPaijQOjDZ6DbqOTNHtAB 9tr7XxcHi28kpLoEoNOyLgpGIlDOtJA2bqU7oraDIeGK/narexqiJr0gnDsfXQ4oXbRK eJFpHT3HQOzieZyeqetbx+xIJBHjsiF94aMIqsuAOTJPFidS21EXQj9uR1jonsPKwsI1 +gYZgOXhWf3lX3hcVeYrNBg3YtQkSwFu3hs7ekAp4JOROVnyosz9FITqIvji/Km2TlpN t4qA== X-Gm-Message-State: AFeK/H0bnpLZXxeaKQahaYoCHJhd3q9MIVtzZIcvzyTac7QiCmRH6y5q8eqwTigSitpTW6XcBWgK0XMPpyjN/wza8WxfkVZPRQfVX3CMZCCYCiMlUaagmyOfk/8dS/FydOu2/w== X-Received: by 10.28.199.132 with SMTP id x126mr9044094wmf.37.1490212321767; Wed, 22 Mar 2017 12:52:01 -0700 (PDT) Received: from [192.168.0.105] (77-85-249-133.ip.btc-net.bg. [77.85.249.133]) by smtp.gmail.com with ESMTPSA id g45sm2992140wrd.11.2017.03.22.12.52.00 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 22 Mar 2017 12:52:00 -0700 (PDT) From: Svetoslav Neykov Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 10.2 \(3259\)) Subject: Re: UsageListener: notified of promotion to master? Date: Wed, 22 Mar 2017 21:52:00 +0200 References: To: dev@brooklyn.apache.org In-Reply-To: Message-Id: X-Mailer: Apple Mail (2.3259) X-Legal-Virus-Advice: 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. X-Legal-Confidentiality: 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. X-Legal-Company-Info: Cloudsoft Corporation Limited. Registered in Scotland. Number: SC349230. Registered Office: 13 Dryden Place, Edinburgh, EH9 1RP. archived-at: Wed, 22 Mar 2017 20:17:33 -0000 > It feels like (2) is a more generally useful feature to add (for = programmatic support, at least). Does it sound useful for things beyond = my use-case? Yes. I needed this exact functionality last week - for a piece of code = shared between all applications. I ended up writing a poller thread that = monitors the state.=20 I think it will be a useful thing to add. Svet. > On 22.03.2017 =D0=B3., at 19:11, Aled Sage = wrote: >=20 > Hi all, >=20 > I'm writing a UsageListener [1] that is going to record the Brooklyn = instance's apps in an external inventory. This is mostly = straight-forward (except needing the fix at [2]). >=20 > The tricky bit is when a Brooklyn standby instance is promoted to = master - I want my listener to be notified so it can record the identity = of the new master Brooklyn for each of the pre-existing app. >=20 > I don't see anywhere I can get a notification of this. Is there? >=20 > --- >=20 > Possible solutions include: >=20 > 1. Add an additional application event (e.g. state > "MANAGEMENT_CHANGED") - the UsageListener would receive this event > for every app when it successfully rebinds. > 2. Register a new kind of listener, to be notified of the management > context's state - on becoming "master", my listener could iterate > over all the apps. >=20 > I don't particularly like either of those options. >=20 > For (1), it isn't really to do with app "Usage" like the other events. >=20 > For (2), my listener code would be fiddly - I'd need to worry about = receiving concurrent notifications via the normal UsageListener while = I'm iterating over the pre-existing apps (assuming the new listener is = called asynchronously, rather than blocking the management context's = startup). >=20 > It feels like (2) is a more generally useful feature to add (for = programmatic support, at least). Does it sound useful for things beyond = my use-case? >=20 > Thoughts? >=20 > Aled >=20 > [1] = https://github.com/apache/brooklyn-server/blob/master/core/src/main/java/o= rg/apache/brooklyn/core/mgmt/usage/UsageListener.java > [2] https://github.com/apache/brooklyn-server/pull/606 >=20 >=20