Repository: curator Updated Branches: refs/heads/CURATOR-3.0 d71f49bf5 -> 73b05aac9
no more need for reflection. there is a getZooKeeperServer() method Project: http://git-wip-us.apache.org/repos/asf/curator/repo Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/d110cbb6 Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/d110cbb6 Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/d110cbb6 Branch: refs/heads/CURATOR-3.0 Commit: d110cbb60ce96d4030e0e6da5accd64baef62eca Parents: d71f49b Author: randgalt <[email protected]> Authored: Wed Sep 9 13:34:51 2015 -0500 Committer: randgalt <[email protected]> Committed: Wed Sep 9 13:34:51 2015 -0500 ---------------------------------------------------------------------- .../java/org/apache/curator/test/TestingZooKeeperMain.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/curator/blob/d110cbb6/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 7d0c6a1..3d0c341 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 @@ -188,15 +188,13 @@ public class TestingZooKeeperMain extends ZooKeeperServerMain implements ZooKeep private ZooKeeperServer getZooKeeperServer(ServerCnxnFactory cnxnFactory) throws Exception { - Field zkServerField = ServerCnxnFactory.class.getDeclaredField("zkServer"); - zkServerField.setAccessible(true); ZooKeeperServer zkServer; // Wait until the zkServer field is non-null long startTime = System.currentTimeMillis(); do { - zkServer = (ZooKeeperServer)zkServerField.get(cnxnFactory); + zkServer = cnxnFactory.getZooKeeperServer(); if ( zkServer == null ) { try @@ -210,7 +208,7 @@ public class TestingZooKeeperMain extends ZooKeeperServerMain implements ZooKeep } } } - while ( (zkServer == null) && ((System.currentTimeMillis() - startTime) < MAX_WAIT_MS) ); + while ( (zkServer == null) && ((System.currentTimeMillis() - startTime) <= MAX_WAIT_MS) ); return zkServer; }
