LOG.debug(AgentI18NResourceKeys.AGENT_REGISTRATION_ABORTED);
retry = false;
} else {
String token = getAgentSecurityToken();
ClientRemotePojoFactory pojo_factory = sender.getClientRemotePojoFactory();
CoreServerService remote_pojo = pojo_factory.getRemotePojo(CoreServerService.class);
AgentConfiguration agent_config = getConfiguration();
ServiceContainerConfiguration server_config = agent_config.getServiceContainerPreferences();
String agent_name = agent_config.getAgentName();
String address = server_config.getConnectorBindAddress();
int port = server_config.getConnectorBindPort();
String remote_endpoint = server_config.getConnectorRemoteEndpoint();
AgentVersion agentVersion = getAgentVersion();
String installId = System.getProperty(AgentRegistrationRequest.SYSPROP_INSTALL_ID);
String installLocation = getAgentHomeDirectory();
if (installLocation != null && installLocation.trim().length() == 0) {
installLocation = null; // tells the server we don't know it
}
AgentRegistrationRequest request = new AgentRegistrationRequest(agent_name, address, port,
remote_endpoint, regenerate_token, token, agentVersion, installId, installLocation);
Thread.sleep(retry_interval);
if (sender.isSending()) {
LOG.debug(AgentI18NResourceKeys.AGENT_REGISTRATION_ATTEMPT, request);
if (!hide_loopback_warning) {
if (remote_endpoint.contains("localhost") || remote_endpoint.contains("127.0.0.")) {
String msg_id = AgentI18NResourceKeys.REGISTERING_WITH_LOOPBACK;
LOG.warn(msg_id, remote_endpoint);
getOut().println(MSG.getMsg(msg_id, remote_endpoint));
getOut().println();
hide_loopback_warning = true; // don't bother to tell the user more than once
}
}
// delete any old token so request is unauthenticated to get server to accept it
agent_config.setAgentSecurityToken(null);
m_commServices.addCustomData(
SecurityTokenCommandAuthenticator.CMDCONFIG_PROP_SECURITY_TOKEN, null);
FailoverListComposite failover_list = null;
try {
AgentRegistrationResults results = remote_pojo.registerAgent(request);
failover_list = results.getFailoverList();
token = results.getAgentToken(); // make sure our finally block gets this - BZ 963982
// Try to do a simple connect to each server in the failover list
// If only some of the servers are unreachable, just keep going;