Navigation Menu

Skip to content

Commit

Permalink
add helper method
Browse files Browse the repository at this point in the history
  • Loading branch information
chenson42 committed May 23, 2012
1 parent 952c274 commit 9ad9469
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
Expand Up @@ -144,5 +144,21 @@ public Node getNode() {
public boolean isLocked() {
return lockTime != null;
}

public long getAverageSuccessPeriod() {
if (totalSuccessCount > 0 && totalSuccessMillis > 0) {
return totalSuccessMillis/totalSuccessCount;
} else {
return 0l;
}
}

public long getAverageFailurePeriod() {
if (totalFailCount > 0 && totalFailMillis > 0) {
return totalFailMillis/totalFailCount;
} else {
return 0l;
}
}

}
Expand Up @@ -10,7 +10,7 @@ public NodeCommunicationServiceSqlMap(IDatabasePlatform platform,
Map<String, String> replacementTokens) {
super(platform, replacementTokens);

putSql("clearLocksOnRestartSql", "update $(node_communication) set lock_time=null where locking_server_id=?");
putSql("clearLocksOnRestartSql", "update $(node_communication) set lock_time=null where locking_server_id=? and lock_time is not null");

putSql("selectNodeCommunicationSql",
"select * from $(node_communication) where communication_type=? order by last_lock_time");
Expand Down

0 comments on commit 9ad9469

Please sign in to comment.