Make sure hooking of answer command callback be called for both sync/Async commands

This commit is contained in:
Kelven Yang 2011-04-04 14:44:03 -07:00
parent 918df1a838
commit 1692caabe8
4 changed files with 6 additions and 7 deletions

View File

@ -22,5 +22,4 @@ public class ListResponse<T extends ResponseObject> extends BaseResponse {
return null;
}
}
}

View File

@ -231,5 +231,5 @@ public interface AgentManager extends Manager {
Answer sendTo(Long dcId, HypervisorType type, Command cmd);
void notifyAnswersFromAttache(long agentId, long seq, Answer[] answers);
void notifyAnswersToMonitors(long agentId, long seq, Answer[] answers);
}

View File

@ -268,7 +268,7 @@ public abstract class AgentAttache {
sendNext(seq);
}
_agentMgr.notifyAnswersFromAttache(_id, seq, answers);
_agentMgr.notifyAnswersToMonitors(_id, seq, answers);
return processed;
}
@ -391,7 +391,7 @@ public abstract class AgentAttache {
// s_logger.debug(log(seq, "Received after timeout: " + new Response(req, answers).toString()));
}
_agentMgr.notifyAnswersFromAttache(_id, seq, answers);
_agentMgr.notifyAnswersToMonitors(_id, seq, answers);
return answers;
}

View File

@ -485,9 +485,9 @@ public class AgentManagerImpl implements AgentManager, HandlerFactory,
}
}
public void notifyAnswersFromAttache(long agentId, long seq, Answer[] answers) {
public void notifyAnswersToMonitors(long agentId, long seq, Answer[] answers) {
for (Pair<Integer, Listener> listener : _cmdMonitors) {
listener.second().processCommands(agentId, seq, answers);
listener.second().processAnswers(agentId, seq, answers);
}
}
@ -1449,7 +1449,7 @@ public class AgentManagerImpl implements AgentManager, HandlerFactory,
Request req = new Request(seq, hostId, _nodeId, cmds,
commands.stopOnError(), true, commands.revertOnError());
Answer[] answers = agent.send(req, timeout);
notifyAnswersFromAttache(hostId, seq, answers);
notifyAnswersToMonitors(hostId, seq, answers);
commands.setAnswers(answers);
return answers;
}