String msg = "Error writing to " + getName();
do {
try {
Status status = (batch == null) ? client.append(avroEvent) : client.appendBatch(batch);
if (!status.equals(Status.OK)) {
throw new AvroRemoteException("RPC communication failed to " + agents[current].getHost() +
":" + agents[current].getPort());
}
return;
} catch (Exception ex) {
if (i == retries - 1) {
msg = "Error writing to " + getName() + " at " + agents[current].getHost() + ":" +
agents[current].getPort();
LOGGER.warn(msg, ex);
break;
}
sleep(delay);
}
} while (++i < retries);
for (int index = 0; index < agents.length; ++index) {
if (index == current) {
continue;
}
Agent agent = agents[index];
i = 0;
do {
try {
transceiver = null;
AvroSourceProtocol c = connect(agent.getHost(), agent.getPort());
Status status = (batch == null) ? c.append(avroEvent) : c.appendBatch(batch);
if (!status.equals(Status.OK)) {
if (i == retries - 1) {
String warnMsg = "RPC communication failed to " + getName() + " at " +
agent.getHost() + ":" + agent.getPort();
LOGGER.warn(warnMsg);
}