/** * For a persistent version tag, the member id should not be null, because we can't fill the * member id in later. */ @Override public void replaceNullIDs(VersionSource memberID) { if (this.getMemberID() == null) { throw new AssertionError("Member id should not be null for persistent version tags"); } }
@Test public void recordVersionIntoLocalMemberShouldFailIfRegionIsPersistent() { LocalRegion mockRegion = mock(LocalRegion.class); when(mockRegion.isInitialized()).thenReturn(true); when(mockRegion.getDataPolicy()).thenReturn(DataPolicy.PERSISTENT_REPLICATE); final String local = getIPLiteral(); DiskStoreID ownerId = new DiskStoreID(); DiskRegionVersionVector rvv = new DiskRegionVersionVector(ownerId, mockRegion); DiskVersionTag tag = new DiskVersionTag(); tag.setRegionVersion(1L); tag.setMemberID(ownerId); expectedException.expect(InternalGemFireError.class); rvv.recordVersion(ownerId, tag); }
public static VersionTag create(boolean persistent, DataInput in) throws IOException, ClassNotFoundException { VersionTag<?> tag; if (persistent) { tag = new DiskVersionTag(); } else { tag = new VMVersionTag(); } InternalDataSerializer.invokeFromData(tag, in); return tag; }
/** * Creates a version tag of the appropriate type, based on the member id * */ public static VersionTag create(VersionSource memberId) { VersionTag tag; if (memberId instanceof DiskStoreID) { tag = new DiskVersionTag(); } else { tag = new VMVersionTag(); } tag.setMemberID(memberId); return tag; }