@Override public boolean getPdxPersistent() { return delegate.getPdxPersistent(); }
public ClientTypeRegistration(InternalCache cache) { this.cache = cache; // See GEODE-5771: Even when set, PDX persistence is internally ignored. if (cache.getPdxPersistent() || StringUtils.isNotBlank(cache.getPdxDiskStore())) { logger.warn("PDX persistence is not supported on client side."); } }
public static boolean mayNeedDiskStore(InternalCache cache) { return !DISABLE_TYPE_REGISTRY && !cache.hasPool() && cache.getPdxPersistent(); }
/** * Check to see if the current member is a loner and we can't tell if the user wants a peer or a * client type registry. * * @return true if this member is a loner and we can't determine what type of registry they want. */ static boolean isIndeterminateLoner(InternalCache cache) { boolean isLoner = cache.getInternalDistributedSystem().isLoner(); boolean pdxConfigured = cache.getPdxPersistent(); return isLoner && !pdxConfigured/* && !hasGateways */; }
protected void setPdxSerializationDetails(final InternalCache cache, final DiskStore diskStore, final DiskStoreDetails diskStoreDetails) { if (cache.getPdxPersistent()) { String diskStoreName = StringUtils.defaultIfBlank(cache.getPdxDiskStore(), DiskStoreDetails.DEFAULT_DISK_STORE_NAME); diskStoreDetails.setPdxSerializationMetaDataStored( ObjectUtils.equals(diskStoreName, diskStore.getName())); } }
public void initialize() { if (!this.cache.getPdxPersistent() || this.cache.getPdxDiskStore() == null || this.cache.findDiskStore(this.cache.getPdxDiskStore()) != null) { this.distributedTypeRegistry.initialize(); } }
private Region<Object/* Integer or EnumCode */, Object/* PdxType or enum info */> getIdToType() { if (this.idToType != null) { return this.idToType; } else { if (this.cache.getPdxPersistent() && this.cache.getCacheConfig().pdxDiskStoreUserSet) { throw new PdxInitializationException( "PDX registry could not be initialized because the disk store " + this.cache.getPdxDiskStore() + " was not created."); } else { throw new PdxInitializationException("PDX registry was not initialized."); } } }
private void checkAllowed(boolean hasGatewaySender, boolean hasPersistentRegion) { if (hasPersistentRegion && !cache.getPdxPersistent()) { throw new PdxInitializationException( "The PDX metadata must be persistent in a member that has persistent data. See CacheFactory.setPdxPersistent."); } int distributedSystemId = cache.getInternalDistributedSystem().getDistributionManager().getDistributedSystemId(); if (hasGatewaySender && distributedSystemId == -1) { throw new PdxInitializationException( "When using PDX with a WAN gateway sender, you must set the distributed-system-id gemfire property for your distributed system. See the javadocs for DistributedSystem."); } }
@Test public void testSetPdxSerializationDetails() { final String diskStoreName = "testDiskStore"; final DiskStore mockDiskStore = mock(DiskStore.class, "DiskStore"); when(mockCache.getPdxPersistent()).thenReturn(true); when(mockCache.getPdxDiskStore()).thenReturn(diskStoreName); when(mockDiskStore.getName()).thenReturn(diskStoreName); final DiskStoreDetails diskStoreDetails = new DiskStoreDetails(diskStoreName, "memberOne"); final DescribeDiskStoreFunction function = new DescribeDiskStoreFunction(); function.setPdxSerializationDetails(mockCache, mockDiskStore, diskStoreDetails); assertThat(diskStoreDetails.isPdxSerializationMetaDataStored()).isTrue(); }
@Test public void testSetPdxSerializationDetailsWhenDiskStoreMismatch() { final DiskStore mockDiskStore = mock(DiskStore.class, "DiskStore"); when(mockCache.getPdxPersistent()).thenReturn(true); when(mockCache.getPdxDiskStore()).thenReturn("mockDiskStore"); when(mockDiskStore.getName()).thenReturn("testDiskStore"); final DiskStoreDetails diskStoreDetails = new DiskStoreDetails("testDiskStore", "memberOne"); final DescribeDiskStoreFunction function = new DescribeDiskStoreFunction(); function.setPdxSerializationDetails(mockCache, mockDiskStore, diskStoreDetails); assertThat(diskStoreDetails.isPdxSerializationMetaDataStored()).isFalse(); }
@Test public void testSetPdxSerializationDetailsWhenPdxIsNotPersistent() { final DiskStore mockDiskStore = mock(DiskStore.class, "DiskStore"); when(mockCache.getPdxPersistent()).thenReturn(false); final DiskStoreDetails diskStoreDetails = new DiskStoreDetails("testDiskStore", "memberOne"); final DescribeDiskStoreFunction function = new DescribeDiskStoreFunction(); function.setPdxSerializationDetails(mockCache, mockDiskStore, diskStoreDetails); assertThat(diskStoreDetails.isPdxSerializationMetaDataStored()).isFalse(); }
when(mockCache.getMyId()).thenReturn(mockMember); when(mockCache.findDiskStore(diskStoreName)).thenReturn(mockDiskStore); when(mockCache.getPdxPersistent()).thenReturn(true); when(mockCache.getPdxDiskStore()).thenReturn("memoryStore"); when(mockMember.getId()).thenReturn(memberId);
when(internalCache.getPdxPersistent()).thenReturn(false);
AttributesFactory<Object, Object> factory = new AttributesFactory<Object, Object>(); factory.setScope(Scope.DISTRIBUTED_ACK); if (cache.getPdxPersistent()) { if (cache.getCacheConfig().pdxDiskStoreUserSet) { factory.setDiskStoreName(cache.getPdxDiskStore());