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 E1843200B3E for ; Wed, 7 Sep 2016 23:29:18 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id E0218160AC1; Wed, 7 Sep 2016 21:29:18 +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 33A60160ABF for ; Wed, 7 Sep 2016 23:29:18 +0200 (CEST) Received: (qmail 7371 invoked by uid 500); 7 Sep 2016 21:29:17 -0000 Mailing-List: contact dev-help@tephra.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@tephra.incubator.apache.org Delivered-To: mailing list dev@tephra.incubator.apache.org Delivered-To: moderator for dev@tephra.incubator.apache.org Received: (qmail 86671 invoked by uid 99); 7 Sep 2016 21:20:58 -0000 X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -5.144 X-Spam-Level: X-Spam-Status: No, score=-5.144 tagged_above=-999 required=6.31 tests=[KAM_LAZY_DOMAIN_SECURITY=1, RCVD_IN_DNSWL_HI=-5, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RP_MATCHES_RCVD=-1.124] autolearn=disabled From: poornachandra To: dev@tephra.incubator.apache.org Reply-To: dev@tephra.incubator.apache.org References: In-Reply-To: Subject: [GitHub] incubator-tephra pull request #2: TEPHRA-179 Create a new instance of Transa... Content-Type: text/plain Message-Id: <20160907212055.50F3BE00C4@git1-us-west.apache.org> Date: Wed, 7 Sep 2016 21:20:55 +0000 (UTC) archived-at: Wed, 07 Sep 2016 21:29:19 -0000 Github user poornachandra commented on a diff in the pull request: https://github.com/apache/incubator-tephra/pull/2#discussion_r77906210 --- Diff: tephra-core/src/test/java/org/apache/tephra/distributed/ThriftTransactionServerTest.java --- @@ -188,21 +224,35 @@ public void process(WatchedEvent event) { }; // Create another Zookeeper session with the same sessionId so that the original one expires. - final ZooKeeper dupZookeeper = + ZooKeeper dupZookeeper = new ZooKeeper(zkClientService.getConnectString(), zooKeeper.getSessionTimeout(), watcher, zooKeeper.getSessionId(), zooKeeper.getSessionPasswd()); connectFuture.get(30, TimeUnit.SECONDS); Assert.assertEquals("Failed to re-create current session", dupZookeeper.getState(), ZooKeeper.States.CONNECTED); dupZookeeper.close(); } - private void waitForThriftTermination() throws InterruptedException { - int count = 0; - while (txService.thriftRPCServerState() != Service.State.TERMINATED && count++ < 200) { + private void waitFor(String errorMessage, Callable callable) throws Exception { + for (int i = 0; i < 200; i++) { + boolean value = callable.call(); + if (value) { + return; + } TimeUnit.MILLISECONDS.sleep(50); } + Assert.fail(errorMessage); + } + + private void waitForThriftStatus() throws Exception { --- End diff -- Rename to `waitForThriftStop` for clarity? --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastructure@apache.org or file a JIRA ticket with INFRA. ---