Skip to content

Commit

Permalink
0003013: Update the heartbeat (sym_node_host) immediately on
Browse files Browse the repository at this point in the history
registration
  • Loading branch information
chenson42 committed Mar 13, 2017
1 parent 4f1def0 commit 1076764
Showing 1 changed file with 8 additions and 0 deletions.
Expand Up @@ -27,6 +27,7 @@
import java.net.UnknownHostException;
import java.sql.Types;
import java.util.Collection;
import java.util.Date;
import java.util.Iterator;
import java.util.List;

Expand All @@ -42,6 +43,7 @@
import org.jumpmind.symmetric.config.INodeIdCreator;
import org.jumpmind.symmetric.model.Node;
import org.jumpmind.symmetric.model.NodeGroupLink;
import org.jumpmind.symmetric.model.NodeHost;
import org.jumpmind.symmetric.model.NodeSecurity;
import org.jumpmind.symmetric.model.RegistrationRequest;
import org.jumpmind.symmetric.model.RegistrationRequest.RegistrationStatus;
Expand Down Expand Up @@ -558,10 +560,16 @@ protected String openRegistration(Node node, String remoteHost, String remoteAdd
password = filterPasswordOnSaveIfNeeded(password);
sqlTemplate.update(getSql("openRegistrationNodeSecuritySql"), new Object[] {
nodeId, password, masterToMasterOnly ? null : me.getNodeId() });
NodeHost nodeHost = new NodeHost(node.getNodeId());
nodeHost.setHeartbeatTime(new Date());
nodeHost.setIpAddress(remoteAddress);
nodeHost.setHostName(remoteHost);
nodeService.updateNodeHost(nodeHost);
nodeService.flushNodeAuthorizedCache();
nodeService.flushNodeCache();
nodeService.insertNodeGroup(node.getNodeGroupId(), null);
nodeService.flushNodeGroupCache();

log.info(
"Just opened registration for external id of {} and a node group of {} and a node id of {}",
new Object[] { node.getExternalId(), node.getNodeGroupId(), nodeId });
Expand Down

0 comments on commit 1076764

Please sign in to comment.