Skip to content

Commit

Permalink
0001322: node_communication locks don't time out
Browse files Browse the repository at this point in the history
  • Loading branch information
chenson42 committed Jul 12, 2013
1 parent a02a2ff commit 2f052d1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Expand Up @@ -288,12 +288,11 @@ public boolean execute(final NodeCommunication nodeCommunication, RemoteNodeStat
Date lockTimeout = getLockTimeoutDate(nodeCommunication.getCommunicationType());
boolean locked = sqlTemplate.update(getSql("aquireLockSql"), clusterService.getServerId(), now, now,
nodeCommunication.getNodeId(), nodeCommunication.getCommunicationType().name(),
lockTimeout, clusterService.getServerId()) == 1;
lockTimeout) == 1;
if (locked) {
nodeCommunication.setLastLockTime(now);
nodeCommunication.setLockingServerId(clusterService.getServerId());
final RemoteNodeStatus status = statuses.add(nodeCommunication.getNode());
ThreadPoolExecutor service = getExecutor(nodeCommunication.getCommunicationType());
Runnable r = new Runnable() {
public void run() {
long ts = System.currentTimeMillis();
Expand All @@ -312,10 +311,11 @@ public void run() {
}
};
if (parameterService.is(ParameterConstants.SYNCHRONIZE_ALL_JOBS)) {
r.run();
r.run();
} else {
ThreadPoolExecutor service = getExecutor(nodeCommunication.getCommunicationType());
service.execute(r);
}
}
}
return locked;
}
Expand Down
Expand Up @@ -55,7 +55,7 @@ public NodeCommunicationServiceSqlMap(IDatabasePlatform platform,
putSql("aquireLockSql",
"update $(node_communication) set locking_server_id=?, lock_time=?, last_lock_time=? where "
+ " node_id=? and communication_type=? and "
+ " (lock_time is null or lock_time < ? or locking_server_id=?) ");
+ " (lock_time is null or lock_time < ?) ");

}

Expand Down

0 comments on commit 2f052d1

Please sign in to comment.