private void getLastCommitInfo(StringBuilder lastCommitParam, LastCommitInfo lastCommitInfo, int size) { // We are at the end, encode the size if (lastCommitInfo == null) { lastCommitParam.Append(Convert.ToString(size)); lastCommitParam.Append(LAST_INFO_SEPARATOR); } else { // Recurse into each LastCommitInfo instance so we can find out the size ... getLastCommitInfo(lastCommitParam, lastCommitInfo.next, ++size); // ... then include this node's info lastCommitInfo.getLastCommitInfo(lastCommitParam); } }
internal LastCommitInfo(LastCommitInfo next) { this.next = next; }
public virtual void setLast(long lastTxnId, int nodeId, long commitSequence) { if (commitSequence <= 0 || lastTxnId <= 0 || nodeId <= 0) { return; } LastCommitInfo lastCommitInfo = getCommitInfo(nodeId); if (lastCommitInfo == null) { lock (this) { lastCommitInfo = getCommitInfo(nodeId); if (lastCommitInfo == null) { infos = lastCommitInfo = new LastCommitInfo(infos); } } } lastCommitInfo.setLast(lastTxnId, nodeId, commitSequence); }