Skip to content

Commit

Permalink
don't allow registration until after initial load
Browse files Browse the repository at this point in the history
  • Loading branch information
erilong committed Dec 20, 2007
1 parent f3504fb commit 55f9048
Showing 1 changed file with 12 additions and 5 deletions.
Expand Up @@ -84,6 +84,13 @@ public class RegistrationService extends AbstractService implements
* registration is open.
*/
public boolean registerNode(Node node, OutputStream out) throws IOException {
if (! configurationService.isRegistrationServer()) {
// registration is not allowed until this node has an initial load
NodeSecurity security = nodeService.findNodeSecurity(nodeService.findIdentity().getNodeId());
if (security != null && security.getInitialLoadTime() == null) {
return false;
}
}
String nodeId = findNodeToRegister(node.getNodeGroupId(), node.getExternalId());
if (nodeId == null && autoRegistration) {
openRegistration(node.getNodeGroupId(), node.getExternalId());
Expand All @@ -101,11 +108,7 @@ public boolean registerNode(Node node, OutputStream out) throws IOException {
Types.VARCHAR, Types.VARCHAR, Types.VARCHAR, Types.VARCHAR });
boolean success = writeConfiguration(node, out);
if (success && autoReload) {
// This node must have its initial load before it can send one to another node
NodeSecurity security = nodeService.findNodeSecurity(nodeService.findIdentity().getNodeId());
if (security != null && security.getInitialLoadTime() == null) {
dataService.reloadNode(node.getNodeId());
}
dataService.reloadNode(node.getNodeId());
}
return success;
}
Expand Down Expand Up @@ -262,4 +265,8 @@ public void setDataService(IDataService dataService) {
this.dataService = dataService;
}

public boolean isAutoRegistration() {
return autoRegistration;
}

}

0 comments on commit 55f9048

Please sign in to comment.