Skip to content

Commit

Permalink
don't run query if node id is null.
Browse files Browse the repository at this point in the history
  • Loading branch information
chenson42 committed Mar 21, 2012
1 parent 52f0b1a commit 5691cae
Showing 1 changed file with 6 additions and 1 deletion.
Expand Up @@ -248,6 +248,8 @@ public List<NodeChannel> getNodeChannels(final String nodeId, boolean refreshExt
nodeChannelCache = new HashMap<String, List<NodeChannel>>();
nodeChannelCacheTime = System.currentTimeMillis();
}

if (nodeId != null) {
nodeChannels = sqlTemplate.query(getSql("selectNodeChannelsSql"),
new ISqlRowMapper<NodeChannel>() {
public NodeChannel mapRow(Row row) {
Expand Down Expand Up @@ -277,9 +279,12 @@ public NodeChannel mapRow(Row row) {
nodeChannel.setDataLoaderType(row.getString("data_loader_type"));
return nodeChannel;
};
}, nodeId);
}, nodeId);
nodeChannelCache.put(nodeId, nodeChannels);
loaded = true;
} else {
nodeChannels = new ArrayList<NodeChannel>(0);
}
}
}
}
Expand Down

0 comments on commit 5691cae

Please sign in to comment.