@Override public void setMapValue(final Object newValue) { if (this != newValue) { Assert.fail("AbstractRegionEntry#setMapValue: unexpected setMapValue " + "with newValue=" + newValue + ", this=" + this); } }
/** * Get the next bit mask position while checking that the value should not exceed given maximum * value. */ protected static int getNextBitMask(int mask, final int maxValue) { mask <<= 1; if (mask > maxValue) { Assert.fail("exhausted bit flags with all available bits: 0x" + Integer.toHexString(mask) + ", max: 0x" + Integer.toHexString(maxValue)); } return mask; }
/** * Creates a VersionedObjectOutput that wraps the specified underlying ObjectOutput. * * @param out the underlying {@link ObjectOutput} * @param version the product version that serialized object on the given {@link ObjectOutput} */ public VersionedObjectOutput(ObjectOutput out, Version version) { if (version.compareTo(Version.CURRENT) > 0) { Assert.fail("unexpected version: " + version + ", CURRENT: " + Version.CURRENT); } this.out = out; this.version = version; }
/** * Write a variable length long the old way (pre 7.0). Use this only in contexts where you might * need to communicate with pre 7.0 members or files. */ public static void writeVLOld(long data, DataOutput out) throws IOException { if (data < 0) { Assert.fail("Data expected to be >=0 is " + data); } if (data <= MAX_BYTE_VL) { out.writeByte((byte) data); } else if (data <= 0x7FFF) { // set the sign bit to indicate a short out.write(((int) data >>> 8 | 0x80) & 0xFF); out.write((int) data >>> 0 & 0xFF); } else if (data <= Integer.MAX_VALUE) { out.writeByte(INT_VL); out.writeInt((int) data); } else { out.writeByte(LONG_VL); out.writeLong(data); } }
public void addRemoteEnum(int enumId, EnumInfo newInfo) { EnumInfo oldInfo = this.idToEnum.get(enumId); if (oldInfo == null) { this.distributedTypeRegistry.addRemoteEnum(enumId, newInfo); this.idToEnum.put(enumId, newInfo); this.enumInfoToId.put(newInfo, enumId); } else if (!oldInfo.equals(newInfo)) { Assert.fail("Old enum does not equal new enum for the same id. oldEnum=" + oldInfo + " new enum=" + newInfo); } }
@Override public DiskEntry initializeRecoveredEntry(Object key, RecoveredEntry re) { if (re.getValue() == null) { Assert.fail("Value should not have been null for key " + key); } currentOplogEntries.put(key, re); return super.initializeRecoveredEntry(key, re); }
public int defineEnum(EnumInfo newInfo) { Integer existingId = this.enumInfoToId.get(newInfo); if (existingId != null) { return existingId; } int id = this.distributedTypeRegistry.defineEnum(newInfo); EnumInfo oldInfo = this.idToEnum.get(id); if (oldInfo == null) { this.idToEnum.put(id, newInfo); this.enumInfoToId.put(newInfo, id); if (logger.isInfoEnabled()) { logger.info("Caching PDX Enum: {}, dsid={} typenum={}", newInfo, id >> 24, id & 0xFFFFFF); } } else if (!oldInfo.equals(newInfo)) { Assert.fail("Old enum does not equal new enum for the same id. oldEnum=" + oldInfo + " newEnum=" + newInfo); } return id; }
public void addRemoteType(int typeId, PdxType newType) { PdxType oldType = this.idToType.get(typeId); if (oldType == null) { this.distributedTypeRegistry.addRemoteType(typeId, newType); this.idToType.put(typeId, newType); this.typeToId.put(newType, typeId); if (logger.isInfoEnabled()) { logger.info("Adding, from remote WAN: {}", newType.toFormattedString()); } } else if (!oldType.equals(newType)) { Assert.fail("Old type does not equal new type for the same id. oldType=" + oldType + " new type=" + newType); } }
/** * Create a type id for a type that may come locally, or from a remote member. */ public int defineType(PdxType newType) { Integer existingId = this.typeToId.get(newType); if (existingId != null) { int eid = existingId; newType.setTypeId(eid); return eid; } int id = this.distributedTypeRegistry.defineType(newType); newType.setTypeId(id); PdxType oldType = this.idToType.get(id); if (oldType == null) { this.idToType.put(id, newType); this.typeToId.put(newType, id); if (logger.isInfoEnabled()) { logger.info("Caching {}", newType.toFormattedString()); } } else if (!oldType.equals(newType)) { Assert.fail("Old type does not equal new type for the same id. oldType=" + oldType + " new type=" + newType); } return id; }
@Override public HashEntry<Object, Object> newEntry(final Object key, final int hash, final HashEntry<Object, Object> next, final Object value) { final AbstractRegionEntry entry = (AbstractRegionEntry) value; // if hash is already set then assert that the two should be same final int entryHash = entry.getEntryHash(); if (hash == 0 || entryHash != 0) { if (entryHash != hash) { Assert.fail("unexpected mismatch of hash, expected=" + hash + ", actual=" + entryHash + " for " + entry); } } entry.setEntryHash(hash); entry.setNextEntry(next); return entry; }
/** * Records a received region-version. These are transmitted in VersionTags in messages between * peers and from servers to clients. * * @param tag the version information */ public void recordVersion(T mbr, VersionTag<T> tag) { tag.setRecorded(); assert tag.isRecorded(); T member = tag.getMemberID(); if (member == null) { member = mbr; } if (this.myId.equals(member)) { // We can be asked to record a version for the local member if a persistent // member is restarted and an event is replayed after the persistent member // recovers. So we can only assert that the local member has already seen // the replayed event. synchronized (localExceptions) { if (this.localVersion.get() < tag.getRegionVersion() && region != null && region.isInitialized() && region.getDataPolicy().withPersistence()) { Assert.fail( "recordVersion invoked for a local version tag that is higher than our local version. rvv=" + this + ", tag=" + tag + " " + region.getName()); } } } recordVersion(member, tag.getRegionVersion()); }
Assert.fail("Attempting to write an entry with keyId=0 to oplog. Entry key=" + entry.getKey() + " diskId=" + entry.getDiskId() + " region=" + dr);