if (exception.isEmpty()) { canon.add(exception); } else { for(ReceivedVersionsIterator it = exception.receivedVersionsIterator(); it.hasNext(); ) { Long received = it.next(); canon.add(insertAt, RVVException.createException(previous, received)); canon.add(insertAt, RVVException.createException(previous, exception.nextVersion));
fine = e.toString(); e.add(missingVersion); if (e.isFilled()) { if (fine != null) { logger.trace(LogMarker.RVV, "Filled exception {}", fine); } else if(e.shouldChangeForm()) { this.exceptions.set(i, e.changeForm());
/** * Returns true if this version hold has an exception in the exception list * for the given version number. * * This differs from contains because it returns true if v is greater * than the last seen version for this holder. */ synchronized boolean hasExceptionFor(long v) { if (this.bitSet != null && v >= this.bitSetVersion) { if (v > this.bitSetVersion+this.bitSet.length()) { return false; } return this.bitSet.get((int)(v-this.bitSetVersion)); } if (this.exceptions == null) { return false; } for (Iterator<RVVException> it = this.exceptions.iterator(); it.hasNext(); ) { RVVException e = it.next(); if (e.nextVersion <= v) { return false; // there is no RVVException for this version } if (e.previousVersion < v && v < e.nextVersion) { return !e.contains(v); } } return false; }
/** * RegionVersionHolder.fromData() calls this to create an exception */ static RVVException createException(DataInput in) throws IOException { long previousVersion = InternalDataSerializer.readUnsignedVL(in); int size = (int)InternalDataSerializer.readUnsignedVL(in); long last = previousVersion; long[] versions = new long[(int)size]; for(int i = 0; i < size; i++) { long delta = InternalDataSerializer.readUnsignedVL(in); long value = delta + last; versions[i] = value; last = value; } long delta = InternalDataSerializer.readUnsignedVL(in); long nextVersion = last + delta; RVVException result = createException(previousVersion, nextVersion, size); for (int i=0; i<size; i++) { result.addReceived(versions[i]); } return result; }
RVVException e = RVVException.createException(this.version, myVersion+1); if (e.compareTo(exception) >= 0) { break;
/** * Add an exception that is older than this.bitSetVersion. */ protected synchronized void addException(long previousVersion, long nextVersion) { if (this.exceptions == null) { this.exceptions = new LinkedList<RVVException>(); } int i = 0; for (Iterator<RVVException> it=this.exceptions.iterator(); it.hasNext(); i++) { RVVException e = it.next(); if (previousVersion >= e.nextVersion) { RVVException except = RVVException.createException(previousVersion, nextVersion); this.exceptions.add(i, except); return; } } this.exceptions.add(RVVException.createException(previousVersion, nextVersion)); }
for(ReceivedVersionsIterator it = ex.receivedVersionsIterator(); it.hasNext(); ) { Long received = it.next(); if(received >= ex.nextVersion) {
public synchronized long getVersion() { RVVException e = null; List<RVVException> exs = getExceptions(); if (!exs.isEmpty()) { e = exs.get(0); } if (isSpecialException(e, this)) { return e.getHighestReceivedVersion(); } else { return this.version; } }
@Override public synchronized RegionVersionHolder<T> clone() { RegionVersionHolder<T> clone = new RegionVersionHolder<T>(this.version); clone.id = this.id; clone.isDepartedMember = this.isDepartedMember; if (this.exceptions != null) { clone.exceptions = new LinkedList<RVVException>(); for (RVVException e: this.exceptions) { clone.exceptions.add(e.clone()); } } if (this.bitSet != null) { clone.bitSet = (BitSet)this.bitSet.clone(); clone.bitSetVersion = this.bitSetVersion; clone.mergeBitSet(); } return clone; }
/** * RegionVersionHolder.fromData() calls this to create an exception */ static RVVException createException(DataInput in) throws IOException { long previousVersion = InternalDataSerializer.readUnsignedVL(in); int size = (int)InternalDataSerializer.readUnsignedVL(in); long last = previousVersion; long[] versions = new long[(int)size]; for(int i = 0; i < size; i++) { long delta = InternalDataSerializer.readUnsignedVL(in); long value = delta + last; versions[i] = value; last = value; } long delta = InternalDataSerializer.readUnsignedVL(in); long nextVersion = last + delta; RVVException result = createException(previousVersion, nextVersion, size); for (int i=0; i<size; i++) { result.addReceived(versions[i]); } return result; }
RVVException e = RVVException.createException(this.version, myVersion+1); if (e.compareTo(exception) >= 0) { break;
/** * Add an exception that is older than this.bitSetVersion. */ protected synchronized void addException(long previousVersion, long nextVersion) { if (this.exceptions == null) { this.exceptions = new LinkedList<RVVException>(); } int i = 0; for (Iterator<RVVException> it=this.exceptions.iterator(); it.hasNext(); i++) { RVVException e = it.next(); if (previousVersion >= e.nextVersion) { RVVException except = RVVException.createException(previousVersion, nextVersion); this.exceptions.add(i, except); return; } } this.exceptions.add(RVVException.createException(previousVersion, nextVersion)); }
public synchronized long getVersion() { RVVException e = null; List<RVVException> exs = getExceptions(); if (!exs.isEmpty()) { e = exs.get(0); } if (isSpecialException(e, this)) { return e.getHighestReceivedVersion(); } else { return this.version; } }
hasSpecialEx = true; clone.exceptions.add(e.clone());
fine = e.toString(); e.add(missingVersion); if (e.isFilled()) { if (fine != null) { logger.info(LocalizedStrings.DEBUG, "Filled exception " + fine); } else if(e.shouldChangeForm()) { this.exceptions.set(i, e.changeForm());
if (exception.isEmpty()) { canon.add(exception); } else { for(ReceivedVersionsIterator it = exception.receivedVersionsIterator(); it.hasNext(); ) { Long received = it.next(); canon.add(insertAt, RVVException.createException(previous, received)); canon.add(insertAt, RVVException.createException(previous, exception.nextVersion));
public void fromData(DataInput in) throws IOException { this.version = InternalDataSerializer.readUnsignedVL(in); int size = (int) InternalDataSerializer.readUnsignedVL(in); this.isDepartedMember = in.readBoolean(); if (size > 0) { this.exceptions = new LinkedList<RVVException>(); for (int i=0; i<size; i++) { RVVException e = RVVException.createException(in); this.exceptions.add(e); } } }
/** * Returns true if this version hold has an exception in the exception list * for the given version number. * * This differs from contains because it returns true if v is greater * than the last seen version for this holder. */ synchronized boolean hasExceptionFor(long v) { if (this.bitSet != null && v >= this.bitSetVersion) { if (v > this.bitSetVersion+this.bitSet.length()) { return false; } return this.bitSet.get((int)(v-this.bitSetVersion)); } if (this.exceptions == null) { return false; } for (Iterator<RVVException> it = this.exceptions.iterator(); it.hasNext(); ) { RVVException e = it.next(); if (e.nextVersion <= v) { return false; // there is no RVVException for this version } if (e.previousVersion < v && v < e.nextVersion) { return !e.contains(v); } } return false; }
public void fromData(DataInput in) throws IOException { this.version = InternalDataSerializer.readUnsignedVL(in); int size = (int) InternalDataSerializer.readUnsignedVL(in); this.isDepartedMember = in.readBoolean(); if (size > 0) { this.exceptions = new LinkedList<RVVException>(); for (int i=0; i<size; i++) { RVVException e = RVVException.createException(in); this.exceptions.add(e); } } }
/** * returns true if this version holder has seen the given version number */ synchronized boolean contains(long v) { if (v > getVersion()) { return false; } else { if (this.bitSet != null && v >= this.bitSetVersion) { return this.bitSet.get((int)(v-this.bitSetVersion)); } if (this.exceptions == null) { return true; } for (Iterator<RVVException> it = this.exceptions.iterator(); it.hasNext(); ) { RVVException e = it.next(); if (e.nextVersion <= v) { return true ; // there is no RVVException for this version } if (e.previousVersion < v && v < e.nextVersion) { return e.contains(v); } } return true; } }