Skip to content

Commit

Permalink
give an option to not record error if node identity is not found
Browse files Browse the repository at this point in the history
  • Loading branch information
chenson42 committed Apr 25, 2013
1 parent b7af5e1 commit 192d29c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
Expand Up @@ -96,6 +96,8 @@ public void ignoreNodeChannelForExternalId(boolean ignore, String channelId,

public Node findIdentity(boolean useCache);

public Node findIdentity(boolean useCache, boolean logSqlError);

public Node getCachedIdentity();

public boolean deleteIdentity();
Expand Down
Expand Up @@ -364,13 +364,20 @@ public Node findIdentity() {
}

public Node findIdentity(boolean useCache) {
return findIdentity(useCache, true);
}

public Node findIdentity(boolean useCache, boolean logSqlError) {
if (cachedNodeIdentity == null || useCache == false) {
try {
List<Node> list = sqlTemplate.query(
getSql("selectNodePrefixSql", "findNodeIdentitySql"), new NodeRowMapper());
cachedNodeIdentity = (Node) getFirstEntry(list);
} catch (SqlException ex) {
log.warn("Failed to load the node identity because: {}. Returning {}", ex.getMessage(), cachedNodeIdentity);
if (logSqlError) {
log.info("Failed to load the node identity because: {}. Returning {}",
ex.getMessage(), cachedNodeIdentity);
}
}
}
return cachedNodeIdentity;
Expand Down
Expand Up @@ -258,5 +258,9 @@ public boolean setReverseInitialLoadEnabled(String nodeId, boolean initialLoadEn
public List<NodeSecurity> findNodeSecurityWithLoadEnabled() {
return null;
}

public Node findIdentity(boolean useCache, boolean logSqlError) {
return null;
}

}
Expand Down

0 comments on commit 192d29c

Please sign in to comment.