* only occur on bucket boundaries.
*/
void recalculate(RepGroupImpl groupInfo) {
/* Find the time the highest CBVLSN was computed. */
VLSN maxCBVLSN = NULL_VLSN;
long latestBarrierTime = 0;
for (RepNodeImpl node : groupInfo.getElectableNodes()) {
BarrierState nodeBarrier = node.getBarrierState();
VLSN cbvlsn = nodeBarrier.getLastCBVLSN();
/*
* Count all nodes, including those that are in the middle of
* syncup and have not established their low point when finding the
* max time.
*/
final long nodeBarrierTime = nodeBarrier.getBarrierTime();
if (maxCBVLSN.compareTo(cbvlsn) <= 0) {
/*
* Use min, since it represents the real change when they are
* equal.
*/
latestBarrierTime = cbvlsn.equals(maxCBVLSN) ?
Math.min(nodeBarrierTime, latestBarrierTime) :
nodeBarrierTime;
maxCBVLSN = cbvlsn;
}
}
if (latestBarrierTime == 0) {
/* No cbvlsns entered yet, don't bother to recalculate. */
return;
}
if (maxCBVLSN.isNull()) {
/* No cbvlsns entered yet, don't bother to recalculate. */
return;
}
/*
* Now find the min CBVLSN that has not been timed out. This may mean
* that the min CBVLSN == NULL_VLSN, for nodes that have not yet
* finished syncup.
*/
VLSN newGroupCBVLSN = maxCBVLSN;
for (RepNodeImpl node : groupInfo.getElectableNodes()) {
BarrierState nodeBarrier = node.getBarrierState();
VLSN nodeCBVLSN = nodeBarrier.getLastCBVLSN();
if (((latestBarrierTime - nodeBarrier.getBarrierTime()) <=
streamTimeoutMs) &&
(newGroupCBVLSN.compareTo(nodeCBVLSN) > 0)) {
newGroupCBVLSN = nodeCBVLSN;