Navigation Menu

Skip to content

Commit

Permalink
0002488: Improve Batch Displays. Removed cache that was causing
Browse files Browse the repository at this point in the history
side-effects.
  • Loading branch information
mmichalek committed May 3, 2016
1 parent c9b0ebd commit 04a5761
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 31 deletions.
Expand Up @@ -36,7 +36,6 @@ public RefreshCacheJob(ISymmetricEngine engine, ThreadPoolTaskScheduler taskSche

@Override
public void doJob(boolean force) throws Exception {
engine.getNodeService().refreshFromDatabase();
engine.getParameterService().refreshFromDatabase();
engine.getTriggerRouterService().refreshFromDatabase();
engine.getGroupletService().refreshFromDatabase();
Expand Down
Expand Up @@ -187,6 +187,4 @@ public void ignoreNodeChannelForExternalId(boolean ignore, String channelId,

public NetworkedNode getRootNetworkedNode();

public boolean refreshFromDatabase();

}
Expand Up @@ -66,8 +66,6 @@ public class NodeService extends AbstractService implements INodeService {

private Node cachedNodeIdentity;

private AtomicReference<List<Node>> cachedNodeList = new AtomicReference<List<Node>>(null);

private Map<String, NodeSecurity> securityCache;

private long securityCacheTime;
Expand Down Expand Up @@ -244,7 +242,6 @@ public void deleteNodeSecurity(String nodeId) {
}

public void deleteNode(String nodeId, boolean syncChange) {
clearCache();
ISqlTransaction transaction = null;
try {
transaction = sqlTemplate.startSqlTransaction();
Expand Down Expand Up @@ -317,7 +314,6 @@ public void insertNodeGroup(String groupId, String description) {
}

public void save(Node node) {
clearCache();
if (!updateNode(node)) {
sqlTemplate.update(
getSql("insertNodeSql"),
Expand All @@ -335,7 +331,6 @@ public void save(Node node) {
}

public boolean updateNode(Node node) {
clearCache();
boolean updated = sqlTemplate.update(
getSql("updateNodeSql"),
new Object[] { node.getNodeGroupId(), node.getExternalId(), node.getDatabaseType(),
Expand Down Expand Up @@ -460,25 +455,9 @@ public List<String> findAllExternalIds() {
}

public List<Node> findAllNodes() {
List<Node> nodeList = cachedNodeList.get();
if (nodeList != null) {
return nodeList;
} else {
nodeList = sqlTemplate.query(getSql("selectNodePrefixSql"), new NodeRowMapper());
cachedNodeList.set(nodeList);
}
List<Node> nodeList = sqlTemplate.query(getSql("selectNodePrefixSql"), new NodeRowMapper());
return nodeList;
}

public void clearCache() {
cachedNodeList.set(null);
}

public boolean refreshFromDatabase() {
clearCache();
findAllNodes();
return true;
}

public Map<String, Node> findAllNodesAsMap() {
List<Node> nodes = findAllNodes();
Expand Down
Expand Up @@ -480,7 +480,6 @@ public void registerWithServer() {
* @see IRegistrationService#reOpenRegistration(String)
*/
public synchronized void reOpenRegistration(String nodeId) {
nodeService.refreshFromDatabase();
Node node = nodeService.findNode(nodeId);
NodeSecurity security = nodeService.findNodeSecurity(nodeId);
String password = null;
Expand Down
Expand Up @@ -296,9 +296,4 @@ public String getExternalId(String nodeId) {
return nodeId;
}

@Override
public boolean refreshFromDatabase() {
return false;
}

}

0 comments on commit 04a5761

Please sign in to comment.