use of com.cloud.legacymodel.communication.command.TransferAgentCommand in project cosmic by MissionCriticalCloud.
the class ClusteredAgentManagerImpl method sendRebalanceCommand.
private Answer[] sendRebalanceCommand(final long peer, final long agentId, final long currentOwnerId, final long futureOwnerId, final Event event) {
final TransferAgentCommand transfer = new TransferAgentCommand(agentId, currentOwnerId, futureOwnerId, event);
final Commands commands = new Commands(Command.OnError.Stop);
commands.addCommand(transfer);
final Command[] cmds = commands.toCommands();
try {
if (s_logger.isDebugEnabled()) {
s_logger.debug("Forwarding " + cmds[0].toString() + " to " + peer);
}
final String peerName = Long.toString(peer);
final String cmdStr = this._gson.toJson(cmds);
final String ansStr = this._clusterMgr.execute(peerName, agentId, cmdStr, true);
final Answer[] answers = this._gson.fromJson(ansStr, Answer[].class);
return answers;
} catch (final Exception e) {
s_logger.warn("Caught exception while talking to " + currentOwnerId, e);
return null;
}
}
Aggregations