Return-Path: Delivered-To: apmail-hadoop-zookeeper-user-archive@minotaur.apache.org Received: (qmail 96866 invoked from network); 7 Jul 2010 00:50:17 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 7 Jul 2010 00:50:17 -0000 Received: (qmail 20530 invoked by uid 500); 7 Jul 2010 00:50:17 -0000 Delivered-To: apmail-hadoop-zookeeper-user-archive@hadoop.apache.org Received: (qmail 20502 invoked by uid 500); 7 Jul 2010 00:50:17 -0000 Mailing-List: contact zookeeper-user-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: zookeeper-user@hadoop.apache.org Delivered-To: mailing list zookeeper-user@hadoop.apache.org Received: (qmail 20494 invoked by uid 99); 7 Jul 2010 00:50:16 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 07 Jul 2010 00:50:16 +0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received: from [140.211.11.9] (HELO minotaur.apache.org) (140.211.11.9) by apache.org (qpsmtpd/0.29) with SMTP; Wed, 07 Jul 2010 00:50:14 +0000 Received: (qmail 96668 invoked by uid 99); 7 Jul 2010 00:49:52 -0000 Received: from localhost.apache.org (HELO [10.0.0.127]) (127.0.0.1) (smtp-auth username phunt, mechanism plain) by minotaur.apache.org (qpsmtpd/0.29) with ESMTP; Wed, 07 Jul 2010 00:49:52 +0000 Message-ID: <4C33CF2F.1030205@apache.org> Date: Tue, 06 Jul 2010 17:49:51 -0700 From: Patrick Hunt User-Agent: Mozilla/5.0 (X11; U; Linux i686 (x86_64); en-US; rv:1.9.1.10) Gecko/20100512 Lightning/1.0b1 Thunderbird/3.0.5 MIME-Version: 1.0 To: zookeeper-user@hadoop.apache.org CC: Jeremy Davis Subject: Re: Suggested way to simulate client session expiration in unit tests? References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org If you want to simulate expiration use the example I sent. > http://github.com/phunt/zkexamples Another option is to use a mock. Patrick On 07/06/2010 05:42 PM, Jeremy Davis wrote: > Thanks! > That seems to work, but it is approximately the same as zooKeeper.close() in > that there is no SessionExpired event that comes up through the default > Watcher. > Maybe I'm assuming more from ZK than I should, but should a paranoid lock > implementation periodically test it's session by reading or writing a value? > > Regards, > -JD > > > On Tue, Jul 6, 2010 at 10:32 AM, Mahadev Konarwrote: > >> Hi Jeremy, >> >> zk.disconnect() is the right way to disconnect from the servers. For >> session expiration you just have to make sure that the client stays >> disconnected for more than the session expiration interval. >> >> Hope that helps. >> >> Thanks >> mahadev >> >> >> On 7/6/10 9:09 AM, "Jeremy Davis" wrote: >> >>> Is there a recommended way of simulating a client session expiration in >> unit >>> tests? >>> I see a TestableZooKeeper.java, with a pauseCnxn() method that does cause >>> the connection to timeout/disconnect and reconnect. Is there an easy way >> to >>> push this all the way through to session expiration? >>> Thanks, >>> -JD >> >> >