Return-Path: X-Original-To: apmail-curator-user-archive@minotaur.apache.org Delivered-To: apmail-curator-user-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id EF04F101DC for ; Wed, 18 Dec 2013 20:02:07 +0000 (UTC) Received: (qmail 19574 invoked by uid 500); 18 Dec 2013 20:02:07 -0000 Delivered-To: apmail-curator-user-archive@curator.apache.org Received: (qmail 19549 invoked by uid 500); 18 Dec 2013 20:02:07 -0000 Mailing-List: contact user-help@curator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@curator.apache.org Delivered-To: mailing list user@curator.apache.org Received: (qmail 19541 invoked by uid 99); 18 Dec 2013 20:02:06 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 18 Dec 2013 20:02:06 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy includes SPF record at spf.trusted-forwarder.org) Received: from [209.85.128.45] (HELO mail-qe0-f45.google.com) (209.85.128.45) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 18 Dec 2013 20:02:00 +0000 Received: by mail-qe0-f45.google.com with SMTP id 6so134653qea.32 for ; Wed, 18 Dec 2013 12:01:39 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:content-type:mime-version:subject:from :in-reply-to:date:content-transfer-encoding:message-id:references:to; bh=sh4RCctQWW0DID8O2Ki0yaOq2xFXGjyoodJ7aOiH7Vg=; b=LgeVUY7vS9pUh2L6RjOYhKGVewl5NsPxr8uD+55Q6n7fg89XiIObNlPZzIFx3dktZL QU1TgjC0VgkKytncTm4J/Z4ErlsSdOMKdEkxaY0p35zjdH65StTZxRqm12OF3PaFHcl9 HVG+SMK6e1NOdCmC7kpfPv40Om/OrmjSfanilsQ7KmY2oREkilRwDW6pki/KADwRIflm c2c0GDhr5OuGowku1yAvEPuzIUObv9d5vzgYveUc5Kvd5iTe0bFlYjQxrdiID3hJQvC3 Dk43mrc0j8qrVLaZhHWm5I/nbqiVJjiv7QVnDgCJMmgy9jexB7PnI7VtyUP4T6HAHtVT Q31g== X-Gm-Message-State: ALoCoQnvfVbQi+pKDV2vzFDVZHQmE1U/EoFoE3xA3N7ZjPC8GspgxalA9jKsiDzu2BpLUUrjeSdT X-Received: by 10.49.39.165 with SMTP id q5mr56824267qek.48.1387396899710; Wed, 18 Dec 2013 12:01:39 -0800 (PST) Received: from [10.0.1.199] ([186.74.84.4]) by mx.google.com with ESMTPSA id a5sm2977081qae.2.2013.12.18.12.01.38 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 18 Dec 2013 12:01:39 -0800 (PST) Content-Type: text/plain; charset=windows-1252 Mime-Version: 1.0 (Mac OS X Mail 7.1 \(1827\)) Subject: Re: Curator in an appserver environment From: Jordan Zimmerman In-Reply-To: Date: Wed, 18 Dec 2013 14:56:53 -0500 Content-Transfer-Encoding: quoted-printable Message-Id: <5034C8AC-139A-4E16-9265-7DD478B01314@jordanzimmerman.com> References: To: user@curator.apache.org X-Mailer: Apple Mail (2.1827) X-Virus-Checked: Checked by ClamAV on apache.org I=92ve personally used Curator with Tomcat and had no problems. Allocate = your own Executors and pass them to Curator or let Curator allocate = them. -Jordan On Dec 17, 2013, at 4:21 PM, Cameron McKenzie = wrote: > I've been using Curator in a standard Java environment, and haven't = had any issues with it, but have just started using the same code in an = appserver environment and have come across an issue. >=20 > While, it's probably considered 'bad' to use Curator in this = environment because it uses its own thread management, it runs fine in = the vast majority of cases. The only time I have experience issues with = it is when trying to call close() on the CuratorFramework instance. = Specifically, calling close() when the app server is shutting down. >=20 > The problem occurs because Curator uses an Executor to send the = 'shutting down' events to listeners, and the appserver has shut down all = its Executor services because it's shutting itself down. >=20 > My work around is to catch any runtime execptions thrown by the = CuratorFramework close() method, and in this case grab the ZooKeeper = connection from Curator and closing this. It's a bit ugly though. >=20 > Any suggestions (other than not using an appserver, or not using = Curator in this environment)?=20 >=20 > One fix would be to not use the Executor during shutdown to send the = events, and instead just do this in the thread doing the shutdown. I = doubt this would have great performance implications, given that you're = unlikely to have millions of listeners. >=20 > Thoughts? > cheers > Cam