@Override public void fromData(DataInput in) throws IOException, ClassNotFoundException { this.prId = in.readInt(); this.scope = Scope.fromOrdinal(in.readByte()); this.pAttrs = PartitionAttributesImpl.createFromData(in); this.isDestroying = in.readBoolean(); this.isColocationComplete = in.readBoolean(); this.nodes = new VersionedArrayList(); InternalDataSerializer.invokeFromData(this.nodes, in); this.partitionResolver = DataSerializer.readString(in); this.colocatedWith = DataSerializer.readString(in); this.fullPath = DataSerializer.readString(in); this.ea = EvictionAttributesImpl.createFromData(in); this.regionIdleTimeout = ExpirationAttributes.createFromData(in); this.regionTimeToLive = ExpirationAttributes.createFromData(in); this.entryIdleTimeout = ExpirationAttributes.createFromData(in); this.entryTimeToLive = ExpirationAttributes.createFromData(in); this.firstDataStoreCreated = in.readBoolean(); this.elderFPAs = DataSerializer.readObject(in); if (this.elderFPAs == null) { this.elderFPAs = new LinkedHashSet<FixedPartitionAttributesImpl>(); } this.partitionListenerClassNames = DataSerializer.readArrayList(in); this.gatewaySenderIds = DataSerializer.readObject(in); if (this.gatewaySenderIds == null) { this.gatewaySenderIds = Collections.emptySet(); } }
/** * Returns Map of the non default Attributes and its values */ public Map<String, String> getNonDefaultAttributes() { if (nonDefaultAttributes == null) { nonDefaultAttributes = new HashMap<String, String>(); if (cloningEnabled != RegionAttributesDefault.CLONING_ENABLED) { nonDefaultAttributes.put( RegionAttributesNames.CLONING_ENABLED, Boolean.toString(cloningEnabled)); } if (compressorClassName != RegionAttributesDefault.COMPRESSOR_CLASS_NAME) { nonDefaultAttributes.put(RegionAttributesNames.COMPRESSOR, compressorClassName); } if (concurrencyChecksEnabled != RegionAttributesDefault.CONCURRENCY_CHECK_ENABLED) { nonDefaultAttributes.put( RegionAttributesNames.CONCURRENCY_CHECK_ENABLED, Boolean.toString(concurrencyChecksEnabled)); } if (concurrencyLevel != RegionAttributesDefault.CONCURRENCY_LEVEL) { nonDefaultAttributes.put( RegionAttributesNames.CONCURRENCY_LEVEL, Integer.toString(concurrencyLevel)); } if (dataPolicy.equals(RegionAttributesDefault.DATA_POLICY)) { nonDefaultAttributes.put(RegionAttributesNames.DATA_POLICY, dataPolicy.toString()); } if (diskStoreName != null && diskStoreName.equals(RegionAttributesDefault.DISK_STORE_NAME)) { nonDefaultAttributes.put(RegionAttributesNames.DISK_STORE_NAME, diskStoreName); } if (enableAsyncConflation != RegionAttributesDefault.ENABLE_ASYNC_CONFLATION) { nonDefaultAttributes.put( RegionAttributesNames.ENABLE_ASYNC_CONFLATION, Boolean.toString(enableAsyncConflation)); } if (enableGateway != RegionAttributesDefault.ENABLE_GATEWAY) { nonDefaultAttributes.put( RegionAttributesNames.ENABLE_GATEWAY, Boolean.toString(enableGateway)); } if (enableSubscriptionConflation != RegionAttributesDefault.ENABLE_SUBSCRIPTION_CONFLATION) { nonDefaultAttributes.put( RegionAttributesNames.ENABLE_SUBSCRIPTION_CONFLATION, Boolean.toString(enableSubscriptionConflation)); } if (entryIdleTimeout != RegionAttributesDefault.ENTRY_IDLE_TIMEOUT) { nonDefaultAttributes.put( RegionAttributesNames.ENTRY_IDLE_TIMEOUT, Integer.toString(entryIdleTimeout)); } if (gatewayHubId != null && !gatewayHubId.isEmpty() && !gatewayHubId.equals(RegionAttributesDefault.GATEWAY_HUB_ID)) { nonDefaultAttributes.put(RegionAttributesNames.GATEWAY_HUB_ID, gatewayHubId); } if (ignoreJTA != RegionAttributesDefault.IGNORE_JTA) { nonDefaultAttributes.put(RegionAttributesNames.IGNORE_JTA, Boolean.toString(ignoreJTA)); } if (indexMaintenanceSynchronous != RegionAttributesDefault.INDEX_MAINTENANCE_SYNCHRONOUS) { nonDefaultAttributes.put( RegionAttributesNames.INDEX_MAINTENANCE_SYNCHRONOUS, Boolean.toString(indexMaintenanceSynchronous)); } if (initialCapacity != RegionAttributesDefault.INITIAL_CAPACITY) { nonDefaultAttributes.put( RegionAttributesNames.INITIAL_CAPACITY, Integer.toString(initialCapacity)); } if (loadFactor != RegionAttributesDefault.LOAD_FACTOR) { nonDefaultAttributes.put(RegionAttributesNames.LOAD_FACTOR, Float.toString(loadFactor)); } if (multicastEnabled != RegionAttributesDefault.MULTICAST_ENABLED) { nonDefaultAttributes.put( RegionAttributesNames.MULTICAST_ENABLED, Boolean.toString(multicastEnabled)); } if (poolName != null && !poolName.equals(RegionAttributesDefault.POOL_NAME)) { nonDefaultAttributes.put(RegionAttributesNames.POOL_NAME, poolName); } if (scope.equals(RegionAttributesDefault.SCOPE)) { nonDefaultAttributes.put(RegionAttributesNames.SCOPE, scope.toString()); } if (statisticsEnabled != RegionAttributesDefault.STATISTICS_ENABLED) { nonDefaultAttributes.put( RegionAttributesNames.STATISTICS_ENABLED, Boolean.toString(statisticsEnabled)); } if (isLockGrantor != RegionAttributesDefault.IS_LOCK_GRANTOR) { nonDefaultAttributes.put( RegionAttributesNames.IS_LOCK_GRANTOR, Boolean.toString(isLockGrantor)); } if (entryIdleTimeout != RegionAttributesDefault.ENTRY_IDLE_TIMEOUT) { nonDefaultAttributes.put( RegionAttributesNames.ENTRY_IDLE_TIMEOUT, Integer.toString(entryIdleTimeout)); } if (entryIdleTimeoutAction != null && !entryIdleTimeoutAction.equals(RegionAttributesDefault.ENTRY_IDLE_TIMEOUT_ACTION)) { nonDefaultAttributes.put( RegionAttributesNames.ENTRY_IDLE_TIMEOUT_ACTION, entryIdleTimeoutAction); } if (entryTimeToLive != RegionAttributesDefault.ENTRY_TIME_TO_LIVE) { nonDefaultAttributes.put( RegionAttributesNames.ENTRY_TIME_TO_LIVE, Integer.toString(entryTimeToLive)); } if (entryTimeToLiveAction != null && !entryTimeToLiveAction.equals(RegionAttributesDefault.ENTRY_TIME_TO_LIVE_ACTION)) { nonDefaultAttributes.put( RegionAttributesNames.ENTRY_TIME_TO_LIVE_ACTION, entryTimeToLiveAction); } if (regionIdleTimeout != RegionAttributesDefault.REGION_IDLE_TIMEOUT) { nonDefaultAttributes.put( RegionAttributesNames.REGION_IDLE_TIMEOUT, Integer.toString(regionIdleTimeout)); } if (regionIdleTimeoutAction != null && !regionIdleTimeoutAction.equals(RegionAttributesDefault.REGION_IDLE_TIMEOUT_ACTION)) { nonDefaultAttributes.put( RegionAttributesNames.REGION_IDLE_TIMEOUT_ACTION, regionIdleTimeoutAction); } if (regionTimeToLive != RegionAttributesDefault.REGION_TIME_TO_LIVE) { nonDefaultAttributes.put( RegionAttributesNames.REGION_TIME_TO_LIVE, Integer.toString(regionTimeToLive)); } if (regionTimeToLiveAction != null && !regionTimeToLiveAction.equals(RegionAttributesDefault.REGION_TIME_TO_LIVE_ACTION)) { nonDefaultAttributes.put( RegionAttributesNames.REGION_TIME_TO_LIVE_ACTION, regionTimeToLiveAction); } if (cacheListenerClassNames != null && !cacheListenerClassNames.isEmpty()) { nonDefaultAttributes.put( RegionAttributesNames.CACHE_LISTENERS, CliUtil.convertStringListToString(cacheListenerClassNames, ',')); } if (cacheLoaderClassName != null && !cacheLoaderClassName.isEmpty()) { nonDefaultAttributes.put(RegionAttributesNames.CACHE_LOADER, cacheLoaderClassName); } if (cacheWriterClassName != null && !cacheWriterClassName.isEmpty()) { nonDefaultAttributes.put(RegionAttributesNames.CACHE_WRITER, cacheWriterClassName); } } return this.nonDefaultAttributes; }
@Override @SuppressWarnings("deprecation") protected Region<K, V> lookupFallback(GemFireCache gemfireCache, String regionName) throws Exception { Assert.isTrue( gemfireCache instanceof Cache, String.format("Unable to create Regions from '%1$s'.", gemfireCache)); Cache cache = (Cache) gemfireCache; RegionFactory<K, V> regionFactory = createRegionFactory(cache); if (hubId != null) { enableGateway = (enableGateway == null || enableGateway); Assert.isTrue(enableGateway, "The 'hubId' requires the 'enableGateway' property to be true."); regionFactory.setGatewayHubId(hubId); } if (enableGateway != null) { if (enableGateway) { Assert.notNull( hubId, "The 'enableGateway' property requires the 'hubId' property to be set."); } regionFactory.setEnableGateway(enableGateway); } if (!ObjectUtils.isEmpty(gatewaySenders)) { Assert.isTrue( hubId == null, "It is invalid to configure a region with both a hubId and gatewaySenders." + " Note that the enableGateway and hubId properties are deprecated since Gemfire 7.0"); for (Object gatewaySender : gatewaySenders) { regionFactory.addGatewaySenderId(((GatewaySender) gatewaySender).getId()); } } if (!ObjectUtils.isEmpty(asyncEventQueues)) { for (Object asyncEventQueue : asyncEventQueues) { regionFactory.addAsyncEventQueueId(((AsyncEventQueue) asyncEventQueue).getId()); } } if (!ObjectUtils.isEmpty(cacheListeners)) { for (CacheListener<K, V> listener : cacheListeners) { regionFactory.addCacheListener(listener); } } if (cacheLoader != null) { regionFactory.setCacheLoader(cacheLoader); } if (cacheWriter != null) { regionFactory.setCacheWriter(cacheWriter); } resolveDataPolicy(regionFactory, persistent, dataPolicy); if (isDiskStoreConfigurationAllowed()) { regionFactory.setDiskStoreName(diskStoreName); } if (scope != null) { regionFactory.setScope(scope); } if (attributes != null) { Assert.state( !attributes.isLockGrantor() || (scope == null) || scope.isGlobal(), "Lock Grantor only applies to a 'GLOBAL' scoped Region."); } postProcess(regionFactory); Region<K, V> region = (getParent() != null ? regionFactory.createSubregion(getParent(), regionName) : regionFactory.create(regionName)); if (log.isInfoEnabled()) { if (getParent() != null) { log.info( String.format( "Created new Cache sub-Region [%1$s] under parent Region [%2$s].", regionName, getParent().getName())); } else { log.info(String.format("Created new Cache Region [%1$s].", regionName)); } } if (snapshot != null) { region.loadSnapshot(snapshot.getInputStream()); } if (attributes != null && attributes.isLockGrantor()) { region.becomeLockGrantor(); } return region; }