You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by el...@apache.org on 2013/07/31 03:59:22 UTC
[02/50] [abbrv] git commit: ACCUMULO-1365 use the MAC mechanism for
finding a random port
ACCUMULO-1365 use the MAC mechanism for finding a random port
git-svn-id: https://svn.apache.org/repos/asf/accumulo/branches/1.4@1477797 13f79535-47bb-0310-9956-ffa450edef68
Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/73c34230
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/73c34230
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/73c34230
Branch: refs/heads/1.5.1-SNAPSHOT
Commit: 73c34230c14c3e8217c014e6600a78692a4faeaa
Parents: bb71618
Author: Eric C. Newton <ec...@apache.org>
Authored: Tue Apr 30 19:48:29 2013 +0000
Committer: Eric C. Newton <ec...@apache.org>
Committed: Tue Apr 30 19:48:29 2013 +0000
----------------------------------------------------------------------
.../src/test/java/org/apache/accumulo/proxy/SimpleTest.java | 5 ++---
.../main/java/org/apache/accumulo/test/MiniAccumuloCluster.java | 2 +-
2 files changed, 3 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/accumulo/blob/73c34230/src/proxy/src/test/java/org/apache/accumulo/proxy/SimpleTest.java
----------------------------------------------------------------------
diff --git a/src/proxy/src/test/java/org/apache/accumulo/proxy/SimpleTest.java b/src/proxy/src/test/java/org/apache/accumulo/proxy/SimpleTest.java
index 744eef4..5474947 100644
--- a/src/proxy/src/test/java/org/apache/accumulo/proxy/SimpleTest.java
+++ b/src/proxy/src/test/java/org/apache/accumulo/proxy/SimpleTest.java
@@ -120,8 +120,7 @@ public class SimpleTest {
protocolFactories.add(org.apache.thrift.protocol.TBinaryProtocol.Factory.class);
protocolFactories.add(org.apache.thrift.protocol.TCompactProtocol.Factory.class);
- Random rand = new Random();
- return protocolFactories.get(rand.nextInt(protocolFactories.size()));
+ return protocolFactories.get(random.nextInt(protocolFactories.size()));
}
@BeforeClass
@@ -137,7 +136,7 @@ public class SimpleTest {
protocolClass = getRandomProtocol();
System.out.println(protocolClass.getName());
- proxyPort = 40000 + random.nextInt(20000);
+ proxyPort = MiniAccumuloCluster.getRandomFreePort();
proxyServer = Proxy.createProxyServer(org.apache.accumulo.proxy.thrift.AccumuloProxy.class, org.apache.accumulo.proxy.ProxyServer.class, proxyPort,
protocolClass, props);
thread = new Thread() {
http://git-wip-us.apache.org/repos/asf/accumulo/blob/73c34230/src/test/src/main/java/org/apache/accumulo/test/MiniAccumuloCluster.java
----------------------------------------------------------------------
diff --git a/src/test/src/main/java/org/apache/accumulo/test/MiniAccumuloCluster.java b/src/test/src/main/java/org/apache/accumulo/test/MiniAccumuloCluster.java
index eb6feb2..e490a3b 100644
--- a/src/test/src/main/java/org/apache/accumulo/test/MiniAccumuloCluster.java
+++ b/src/test/src/main/java/org/apache/accumulo/test/MiniAccumuloCluster.java
@@ -124,7 +124,7 @@ public class MiniAccumuloCluster {
private MiniAccumuloConfig config;
private Process[] tabletServerProcesses;
- private int getRandomFreePort() {
+ static public int getRandomFreePort() {
Random r = new Random();
int count = 0;