if (agentIdentity != null) {
agentInfo.setAgentIdentity(agentIdentity);
agentInfo.setName(agentIdentity.getName());
agentInfo.setRegion(agentIdentity.getRegion());
agentInfo.setIp(agentIdentity.getIp());
AgentManager agentManager = getAgentManager();
agentInfo.setPort(agentManager.getAgentConnectingPort(agentIdentity));
agentInfo.setState(agentManager.getAgentState(agentIdentity));
agentInfo.setVersion(agentManager.getAgentVersion(agentIdentity));
}
return agentInfo;
}