Skip to content

Commit

Permalink
change api to pass in whether the removal of a node should be synchro…
Browse files Browse the repository at this point in the history
…nized
  • Loading branch information
chenson42 committed Apr 17, 2013
1 parent be5bce3 commit 315c848
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 10 deletions.
Expand Up @@ -736,7 +736,7 @@ public NodeStatus getNodeStatus() {

public void removeAndCleanupNode(String nodeId) {
log.warn("Removing node {}", nodeId);
nodeService.deleteNode(nodeId);
nodeService.deleteNode(nodeId, false);
log.warn("Marking outgoing batch records as Ok for {}", nodeId);
outgoingBatchService.markAllAsSentForNode(nodeId);
log.warn("Marking incoming batch records as Ok for {}", nodeId);
Expand Down
Expand Up @@ -77,7 +77,7 @@ public interface INodeService {

public void deleteNodeSecurity(String nodeId);

public void deleteNode(String nodeId);
public void deleteNode(String nodeId, boolean syncChange);

public String findSymmetricVersion();

Expand Down
Expand Up @@ -218,14 +218,27 @@ public void deleteNodeSecurity(String nodeId) {
sqlTemplate.update(getSql("deleteNodeSecuritySql"), new Object[] { nodeId });
}

public void deleteNode(String nodeId) {
if (StringUtils.isNotBlank(nodeId)) {
if (nodeId.equals(findIdentityNodeId())) {
sqlTemplate.update(getSql("deleteNodeIdentitySql"));
public void deleteNode(String nodeId, boolean syncChange) {
ISqlTransaction transaction = null;
try {
transaction = sqlTemplate.startSqlTransaction();
if (!syncChange) {
symmetricDialect.disableSyncTriggers(transaction, nodeId);
}
if (StringUtils.isNotBlank(nodeId)) {
if (nodeId.equals(findIdentityNodeId())) {
transaction.prepareAndExecute(getSql("deleteNodeIdentitySql"));
}
transaction.prepareAndExecute(getSql("deleteNodeSecuritySql"), new Object[] { nodeId });
transaction.prepareAndExecute(getSql("deleteNodeHostSql"), new Object[] { nodeId });
transaction.prepareAndExecute(getSql("deleteNodeSql"), new Object[] { nodeId });
}
deleteNodeSecurity(nodeId);
sqlTemplate.update(getSql("deleteNodeHostSql"), new Object[] { nodeId });
sqlTemplate.update(getSql("deleteNodeSql"), new Object[] { nodeId });
} finally {
if (!syncChange) {
symmetricDialect.enableSyncTriggers(transaction);
}

close(transaction);
}
}

Expand Down
Expand Up @@ -48,7 +48,7 @@ public List<Node> findAllNodes() {
return null;
}

public void deleteNode(String nodeId) {
public void deleteNode(String nodeId, boolean syncChange) {
}

public List<String> findAllExternalIds() {
Expand Down

0 comments on commit 315c848

Please sign in to comment.