MCPcopy Create free account
hub / github.com/e2wugui/zeze / getRandomConnector

Method getRandomConnector

ZezeJava/ZezeJava/src/main/java/Zeze/Raft/Agent.java:383–390  ·  view source on GitHub ↗
(Connector except)

Source from the content-addressed store, hash-verified

381 }
382
383 private Connector getRandomConnector(Connector except) {
384 var notMe = new ArrayList<Connector>(client.getConfig().connectorCount());
385 client.getConfig().forEachConnector(c -> {
386 if (c != except)
387 notMe.add(c);
388 });
389 return notMe.isEmpty() ? null : notMe.get(Random.getInstance().nextInt(notMe.size()));
390 }
391
392 private long processLeaderIs(LeaderIs r) throws Exception {
393 ConnectorProxy leader = this.leader;

Callers 1

processLeaderIsMethod · 0.95

Calls 9

getInstanceMethod · 0.95
connectorCountMethod · 0.80
forEachConnectorMethod · 0.80
addMethod · 0.65
isEmptyMethod · 0.65
getMethod · 0.65
sizeMethod · 0.65
getConfigMethod · 0.45
nextIntMethod · 0.45

Tested by

no test coverage detected