return;
}
WatchdogService watchdogService =
ChannelServiceImpl.getWatchdogService();
TaskService taskService = ChannelServiceImpl.getTaskService();
BigInteger channelRefId = new BigInteger(channelIter.next());
channelIter.remove();
ChannelImpl channel = (ChannelImpl) getObjectForId(channelRefId);
if (channel != null) {
channel.reassignCoordinator(failedNodeId);
/*
* If other channel servers have failed, remove the failed
* server node ID from the channel too. This covers the
* case where a channel coordinator (informed of a node
* failure) fails before it has a chance to schedule a task
* to remove the server node ID for another failed node
* (cascading failure during recovery).
*/
for (long serverNodeId : channel.getServerNodeIds()) {
Node serverNode = watchdogService.getNode(serverNodeId);
if (serverNode == null || !serverNode.isAlive()) {
channel.removeServerNodeId(serverNodeId);
}
}
}
/*
* Schedule a task to reassign the next channel coordinator, or
* if done with coordinator reassignment, remove the recovered
* node's mapping from the node-to-event-queues map.
*/
if (channelIter.hasNext()) {
taskService.scheduleTask(this);
}
}