InterCoronaJobTrackerProtocol secondaryClient = RPC.waitForProxy(
InterCoronaJobTrackerProtocol.class,
InterCoronaJobTrackerProtocol.versionID, secondaryTracker, conf,
SECONDARY_TRACKER_CONNECT_TIMEOUT);
// Obtain new address
InetSocketAddressWritable oldAddrWritable = new InetSocketAddressWritable(
oldAddress);
InetSocketAddressWritable newAddress = null;
int retryNum = 0;
do {
newAddress = secondaryClient.getNewJobTrackerAddress(oldAddrWritable);
try {
waitRetry();
} catch (InterruptedException e) {
LOG.error("Fallback interrupted, taking next retry.");
}
++retryNum;
} while (newAddress == null && predRetry(retryNum));
if (newAddress == null || newAddress.getAddress() == null)
throw new IOException("Failed to obtain new job tracker address.");
RPC.stopProxy(secondaryClient);
try {
connect(newAddress.getAddress());
LOG.info("Fallback process successful: " + newAddress.getAddress());
} catch (IOException e) {
LOG.error("Fallback connect to " + newAddress.getAddress() + " failed for ", e);
reconnectToNewJobTracker(++connectNum);
}
}