mirror of https://github.com/apache/lucene.git
made this test smarter
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@927848 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
256789a4ff
commit
ad7faf9b1a
solr/src/test/org/apache/solr/core
|
@ -54,15 +54,20 @@ public class TestJmxMonitoredMap {
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
for (int i = 0; i < 5; i++) {
|
int retries = 5;
|
||||||
|
for (int i = 0; i < retries; i++) {
|
||||||
try {
|
try {
|
||||||
ServerSocket server = new ServerSocket(0);
|
ServerSocket server = new ServerSocket(0);
|
||||||
port = server.getLocalPort();
|
try {
|
||||||
server.close();
|
port = server.getLocalPort();
|
||||||
|
} finally {
|
||||||
|
server.close();
|
||||||
|
}
|
||||||
// System.out.println("Using port: " + port);
|
// System.out.println("Using port: " + port);
|
||||||
try {
|
try {
|
||||||
LocateRegistry.createRegistry(port);
|
LocateRegistry.createRegistry(port);
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
|
throw e;
|
||||||
}
|
}
|
||||||
String url = "service:jmx:rmi:///jndi/rmi://:" + port + "/solrjmx";
|
String url = "service:jmx:rmi:///jndi/rmi://:" + port + "/solrjmx";
|
||||||
JmxConfiguration config = new JmxConfiguration(true, null, url);
|
JmxConfiguration config = new JmxConfiguration(true, null, url);
|
||||||
|
@ -72,7 +77,9 @@ public class TestJmxMonitoredMap {
|
||||||
mbeanServer = connector.getMBeanServerConnection();
|
mbeanServer = connector.getMBeanServerConnection();
|
||||||
break;
|
break;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
if(retries == (i + 1)) {
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue