Return-Path: X-Original-To: apmail-curator-commits-archive@minotaur.apache.org Delivered-To: apmail-curator-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id E25ED17B93 for ; Thu, 10 Sep 2015 14:22:18 +0000 (UTC) Received: (qmail 18946 invoked by uid 500); 10 Sep 2015 14:22:18 -0000 Delivered-To: apmail-curator-commits-archive@curator.apache.org Received: (qmail 18917 invoked by uid 500); 10 Sep 2015 14:22:18 -0000 Mailing-List: contact commits-help@curator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@curator.apache.org Delivered-To: mailing list commits@curator.apache.org Received: (qmail 18907 invoked by uid 99); 10 Sep 2015 14:22:18 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 10 Sep 2015 14:22:18 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 9FB75E0850; Thu, 10 Sep 2015 14:22:18 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: randgalt@apache.org To: commits@curator.apache.org Message-Id: <6bdb14510b78492cbb2c2c4f812c1f2f@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: curator git commit: moved to ZK 3.5.1. Date: Thu, 10 Sep 2015 14:22:18 +0000 (UTC) Repository: curator Updated Branches: refs/heads/CURATOR-261 911f02b15 -> fad270861 moved to ZK 3.5.1. Project: http://git-wip-us.apache.org/repos/asf/curator/repo Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/fad27086 Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/fad27086 Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/fad27086 Branch: refs/heads/CURATOR-261 Commit: fad270861feb4dbda36fdea76b4db9ec29e92001 Parents: 911f02b Author: randgalt Authored: Thu Sep 10 09:22:11 2015 -0500 Committer: randgalt Committed: Thu Sep 10 09:22:11 2015 -0500 ---------------------------------------------------------------------- .../recipes/leader/ChaosMonkeyCnxnFactory.java | 2 -- .../curator/test/TestingZooKeeperMain.java | 36 +++++++++++++++----- pom.xml | 11 +----- 3 files changed, 29 insertions(+), 20 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/curator/blob/fad27086/curator-recipes/src/test/java/org/apache/curator/framework/recipes/leader/ChaosMonkeyCnxnFactory.java ---------------------------------------------------------------------- diff --git a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/leader/ChaosMonkeyCnxnFactory.java b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/leader/ChaosMonkeyCnxnFactory.java index 3aeec81..4cb342c 100644 --- a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/leader/ChaosMonkeyCnxnFactory.java +++ b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/leader/ChaosMonkeyCnxnFactory.java @@ -31,8 +31,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.io.IOException; import java.nio.ByteBuffer; -import java.nio.channels.SelectionKey; -import java.nio.channels.SocketChannel; /** * A connection factory that will behave like the NIOServerCnxnFactory except that http://git-wip-us.apache.org/repos/asf/curator/blob/fad27086/curator-test/src/main/java/org/apache/curator/test/TestingZooKeeperMain.java ---------------------------------------------------------------------- diff --git a/curator-test/src/main/java/org/apache/curator/test/TestingZooKeeperMain.java b/curator-test/src/main/java/org/apache/curator/test/TestingZooKeeperMain.java index 702824a..a4cca8e 100644 --- a/curator-test/src/main/java/org/apache/curator/test/TestingZooKeeperMain.java +++ b/curator-test/src/main/java/org/apache/curator/test/TestingZooKeeperMain.java @@ -30,12 +30,14 @@ import org.apache.zookeeper.server.quorum.QuorumPeer; import org.apache.zookeeper.server.quorum.QuorumPeerConfig; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.testng.Assert; import javax.management.JMException; import java.io.IOException; import java.lang.reflect.Field; import java.lang.reflect.Modifier; import java.nio.channels.ServerSocketChannel; import java.util.concurrent.CountDownLatch; +import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicReference; public class TestingZooKeeperMain implements ZooKeeperMainFace @@ -48,7 +50,9 @@ public class TestingZooKeeperMain implements ZooKeeperMainFace private volatile ServerCnxnFactory cnxnFactory; private volatile ZooKeeperServer zkServer; - static final int MAX_WAIT_MS = new Timing().milliseconds(); + private static final Timing timing = new Timing(); + + static final int MAX_WAIT_MS = timing.milliseconds(); @Override public void kill() @@ -124,7 +128,7 @@ public class TestingZooKeeperMain implements ZooKeeperMainFace @Override public void blockUntilStarted() throws Exception { - latch.await(); + Assert.assertTrue(timing.awaitLatch(latch)); if ( zkServer != null ) { @@ -139,7 +143,7 @@ public class TestingZooKeeperMain implements ZooKeeperMainFace } else { - throw new Exception("No zkServer. zkServer is volatile: " + Modifier.isVolatile(cnxnFactory.getClass().getDeclaredField("zkServer").getModifiers())); + throw new Exception("No zkServer."); } Exception exception = startingException.get(); @@ -201,9 +205,17 @@ public class TestingZooKeeperMain implements ZooKeeperMainFace txnLog = new FileTxnSnapLog(config.getDataLogDir(), config.getDataDir()); zkServer = new TestZooKeeperServer(txnLog, config); - cnxnFactory = ServerCnxnFactory.createFactory(); - cnxnFactory.configure(config.getClientPortAddress(), - config.getMaxClientCnxns()); + try + { + cnxnFactory = ServerCnxnFactory.createFactory(); + cnxnFactory.configure(config.getClientPortAddress(), + config.getMaxClientCnxns()); + } + catch ( IOException e ) + { + log.info("Could not server. Waiting and trying one more time.", e); + timing.sleepABit(); + } cnxnFactory.startup(zkServer); latch.countDown(); cnxnFactory.join(); @@ -228,6 +240,8 @@ public class TestingZooKeeperMain implements ZooKeeperMainFace super(txnLog, config.getTickTime(), config.getMinSessionTimeout(), config.getMaxSessionTimeout(), null); } + private final AtomicBoolean isRunning = new AtomicBoolean(false); + protected void registerJMX() { // NOP @@ -239,11 +253,17 @@ public class TestingZooKeeperMain implements ZooKeeperMainFace // NOP } + @Override + public boolean isRunning() + { + return isRunning.get() || super.isRunning(); + } + public void noteStartup() { synchronized (this) { - running = true; - notifyAll(); + isRunning.set(true); + this.notifyAll(); } } } http://git-wip-us.apache.org/repos/asf/curator/blob/fad27086/pom.xml ---------------------------------------------------------------------- diff --git a/pom.xml b/pom.xml index 59ed3e0..567eb8f 100644 --- a/pom.xml +++ b/pom.xml @@ -59,7 +59,7 @@ 1.7 - 3.5.0-alpha + 3.5.1-alpha 2.7 2.3.7 2.10.3 @@ -79,7 +79,6 @@ 2.3 1.7.6 2.6.1 - 2.18.1 @@ -546,12 +545,6 @@ clirr-maven-plugin ${clirr-maven-plugin-version} - - - org.apache.maven.plugins - maven-surefire-plugin - ${maven-surefire-plugin-version} - @@ -630,8 +623,6 @@ maven-surefire-plugin true - 1 - false