http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8bf39571/geode-core/src/main/java/org/apache/geode/cache/AttributesFactory.java ---------------------------------------------------------------------- diff --git a/geode-core/src/main/java/org/apache/geode/cache/AttributesFactory.java b/geode-core/src/main/java/org/apache/geode/cache/AttributesFactory.java index 3418c21..1a46f24 100644 --- a/geode-core/src/main/java/org/apache/geode/cache/AttributesFactory.java +++ b/geode-core/src/main/java/org/apache/geode/cache/AttributesFactory.java @@ -1,18 +1,16 @@ /* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license + * agreements. See the NOTICE file distributed with this work for additional information regarding + * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. You may obtain a + * copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. */ package org.apache.geode.cache; @@ -41,42 +39,39 @@ import org.apache.geode.internal.cache.UserSpecifiedRegionAttributes; import org.apache.geode.internal.cache.xmlcache.RegionAttributesCreation; import org.apache.geode.internal.i18n.LocalizedStrings; -/** Creates instances of {@link RegionAttributes}. An <code>AttributesFactory</code> - * instance maintains state for creating <code>RegionAttributes</code> instances. - * The setter methods are used to change the settings that will be used for - * creating the next attributes instance with the {@link #create} - * method. If you create a factory with the default constructor, then the - * factory is set up to create attributes with all default settings. You can - * also create a factory by providing a <code>RegionAttributes</code>, which - * will set up the new factory with the settings provided in that attributes - * instance. +/** + * Creates instances of {@link RegionAttributes}. An <code>AttributesFactory</code> instance + * maintains state for creating <code>RegionAttributes</code> instances. The setter methods are used + * to change the settings that will be used for creating the next attributes instance with the + * {@link #create} method. If you create a factory with the default constructor, then the factory is + * set up to create attributes with all default settings. You can also create a factory by providing + * a <code>RegionAttributes</code>, which will set up the new factory with the settings provided in + * that attributes instance. * - * <p>Once a <code>RegionAttributes</code> is created, it can only be modified - * after it has been used to create a <code>Region</code>, and then only by - * using an {@link AttributesMutator} obtained from the region. + * <p> + * Once a <code>RegionAttributes</code> is created, it can only be modified after it has been used + * to create a <code>Region</code>, and then only by using an {@link AttributesMutator} obtained + * from the region. * * <h3>Attributes</h3> * <h4>Callbacks</h4> * <dl> * <dt>{@link CacheLoader} [<em>default:</em> <code>null</code>, meaning no loader]</dt> - * <dd>User-implemented plug-in for loading data on cache misses.<br> - * {@link #setCacheLoader} {@link RegionAttributes#getCacheLoader} - * {@link AttributesMutator#setCacheLoader}</dd> + * <dd>User-implemented plug-in for loading data on cache misses.<br> + * {@link #setCacheLoader} {@link RegionAttributes#getCacheLoader} + * {@link AttributesMutator#setCacheLoader}</dd> * * <dt>{@link CacheWriter} [<em>default:</em> <code>null</code>, meaning no writer]</dt> - * <dd>User-implemented plug-in for intercepting cache modifications, e.g. - * for writing to an external data source.<br> - * {@link #setCacheWriter} {@link RegionAttributes#getCacheWriter} - * {@link AttributesMutator#setCacheWriter}</dd> + * <dd>User-implemented plug-in for intercepting cache modifications, e.g. for writing to an + * external data source.<br> + * {@link #setCacheWriter} {@link RegionAttributes#getCacheWriter} + * {@link AttributesMutator#setCacheWriter}</dd> * * <dt>{@link CacheListener} [<em>default:</em> <code>null</code>, meaning no listener ]</dt> - * <dd>User-implemented plug-in for receiving and handling cache related events.<br> - * {@link #addCacheListener} {@link #initCacheListeners} - * {@link #initCacheListeners} - * {@link RegionAttributes#getCacheListeners} - * {@link AttributesMutator#initCacheListeners} - * {@link AttributesMutator#addCacheListener} - * {@link AttributesMutator#removeCacheListener}</dd> + * <dd>User-implemented plug-in for receiving and handling cache related events.<br> + * {@link #addCacheListener} {@link #initCacheListeners} {@link #initCacheListeners} + * {@link RegionAttributes#getCacheListeners} {@link AttributesMutator#initCacheListeners} + * {@link AttributesMutator#addCacheListener} {@link AttributesMutator#removeCacheListener}</dd> * </dl> * <h4>Expiration</h4> * <dl> @@ -106,96 +101,80 @@ import org.apache.geode.internal.i18n.LocalizedStrings; * </dl> * <h4>Distribution</h4> * <dl> - * <dt>{@link Scope}[<em>default:</em> {@link Scope#DISTRIBUTED_NO_ACK}] - * </dt> - * <dd>Properties of distribution for the region, including whether it is - * distributed at all, whether acknowledgements are required, and whether - * distributed synchronization is required. <br> + * <dt>{@link Scope}[<em>default:</em> {@link Scope#DISTRIBUTED_NO_ACK}]</dt> + * <dd>Properties of distribution for the region, including whether it is distributed at all, + * whether acknowledgements are required, and whether distributed synchronization is required. <br> * {@link #setScope} {@link RegionAttributes#getScope}</dd> * * <dt>EarlyAck [<em>default:</em> <code>false</code>]</dt> - * <dd>Whether or not acks required by <code>Scope.DISTRIBUTED_ACK</code> - * are sent after an operation is processed. If <code>true</code> - * then remote caches will ACK before processing an operation sent - * by the cache that has set earlyAck to <code>true</code>. - * Note that this attribute is only meaningful on the cache that - * is initiating an operation; it does not matter what it is set to - * on the cache that receives the operation.<br> - * {@link #setEarlyAck} {@link RegionAttributes#getEarlyAck}</dd> - + * <dd>Whether or not acks required by <code>Scope.DISTRIBUTED_ACK</code> are sent after an + * operation is processed. If <code>true</code> then remote caches will ACK before processing an + * operation sent by the cache that has set earlyAck to <code>true</code>. Note that this attribute + * is only meaningful on the cache that is initiating an operation; it does not matter what it is + * set to on the cache that receives the operation.<br> + * {@link #setEarlyAck} {@link RegionAttributes#getEarlyAck}</dd> + * * <dt>{@link SubscriptionAttributes} [<em>default:</em> {@link InterestPolicy#DEFAULT}]</dt> - * <dd>How will the region in this cache subscribe to other distributed - * instances of this region. - * <br> - * {@link #setSubscriptionAttributes} {@link RegionAttributes#getSubscriptionAttributes}</dd> + * <dd>How will the region in this cache subscribe to other distributed instances of this region. + * <br> + * {@link #setSubscriptionAttributes} {@link RegionAttributes#getSubscriptionAttributes}</dd> * * <dt>EnableAsyncConflation [<em>default:</em> <code>false</code>]</dt> - * <dd>Whether or not conflation is enabled for sending - * messages to async peers. Async peers are those whose - * <code>async-distribution-timeout</code> gemfire.property is greater - * than zero. AsyncConflation is ignored if the scope is - * <code>DISTRIBUTED_ACK</code> or <code>GLOBAL</code>. - * Conflation is only done on entry update operations. It is done - * by dropping the earlier update from the message queue. - * {@link #setEnableAsyncConflation} {@link RegionAttributes#getEnableAsyncConflation}</dd> + * <dd>Whether or not conflation is enabled for sending messages to async peers. Async peers are + * those whose <code>async-distribution-timeout</code> gemfire.property is greater than zero. + * AsyncConflation is ignored if the scope is <code>DISTRIBUTED_ACK</code> or <code>GLOBAL</code>. + * Conflation is only done on entry update operations. It is done by dropping the earlier update + * from the message queue. {@link #setEnableAsyncConflation} + * {@link RegionAttributes#getEnableAsyncConflation}</dd> * <dt>poolName [<em>default:</em> <code>null</code>, meaning no pool]</dt> - * <dd>Whether or not this region is a client that is to use - * connections from the named pool to communicate with servers. - * If <code>null</code>, then it is not a client. - * If <code>non-null</code>, then the named pool will be used. - * {@link #setPoolName} {@link RegionAttributes#getPoolName}</dd> + * <dd>Whether or not this region is a client that is to use connections from the named pool to + * communicate with servers. If <code>null</code>, then it is not a client. If + * <code>non-null</code>, then the named pool will be used. {@link #setPoolName} + * {@link RegionAttributes#getPoolName}</dd> * * * <dt>EnableSubscriptionConflation [<em>default:</em> <code>false</code>]</dt> - * <dd>Whether or not conflation is enabled for sending - * messages from a cache server to its clients. Note: This parameter - * is only valid for cache server to client communication. It has no - * effect in peer to peer communication. - * If <code>true</code>, messages will be conflated before they are - * sent from a cache server to its clients. Only the latest value - * will be sent. - * Note that this attribute is only meaningful in a client server - * topology. - * {@link #setEnableSubscriptionConflation} {@link RegionAttributes#getEnableSubscriptionConflation}</dd> + * <dd>Whether or not conflation is enabled for sending messages from a cache server to its clients. + * Note: This parameter is only valid for cache server to client communication. It has no effect in + * peer to peer communication. If <code>true</code>, messages will be conflated before they are sent + * from a cache server to its clients. Only the latest value will be sent. Note that this attribute + * is only meaningful in a client server topology. {@link #setEnableSubscriptionConflation} + * {@link RegionAttributes#getEnableSubscriptionConflation}</dd> * <dt>Publisher [<em>default:</em> <code>false</code>]</dt> - * <dd>Whether or not a region is a publisher. Publishers are regions - * that will have distributed write operations done on them. - * If a publisher is also a replicate then it will be used - * as the preferred source for initializing other replicates. - * {@link #setPublisher} {@link RegionAttributes#getPublisher}</dd> + * <dd>Whether or not a region is a publisher. Publishers are regions that will have distributed + * write operations done on them. If a publisher is also a replicate then it will be used as the + * preferred source for initializing other replicates. {@link #setPublisher} + * {@link RegionAttributes#getPublisher}</dd> * <dt>isCloningEnabled [<em>default:</em> <code>false</code>]</dt> - * <dd>Whether or not value is cloned before appling <code>Delta</code>s - * If <code>false</code>, value will not be cloned - * {@link #setCloningEnabled} {@link RegionAttributes#getCloningEnabled()}</dd></dt> + * <dd>Whether or not value is cloned before appling <code>Delta</code>s If <code>false</code>, + * value will not be cloned {@link #setCloningEnabled} + * {@link RegionAttributes#getCloningEnabled()}</dd></dt> * </dl> - * <h4>Storage (see also <a href="package-summary.html#storage">package summary - * </a>)</h4> + * <h4>Storage (see also <a href="package-summary.html#storage">package summary </a>)</h4> * <dl> * <dt>{@link DataPolicy} [<em>default:</em> <code>DataPolicy.NORMAL</code>]</dt> - * <dd>Specifies the data storage policy.<br> - * {@link #setDataPolicy} {@link RegionAttributes#getDataPolicy}</dd> + * <dd>Specifies the data storage policy.<br> + * {@link #setDataPolicy} {@link RegionAttributes#getDataPolicy}</dd> * * <dt>{@link MirrorType} [<em>default:</em> <code>MirrorType.NONE</code>]</dt> - * <dd><em>Deprecated</em>, use DataPolicy instead.</dd> + * <dd><em>Deprecated</em>, use DataPolicy instead.</dd> * * <dt>{@link #setEvictionAttributes(EvictionAttributes) EvictionAttributes}</dt> - * <dd>{@link EvictionAttributes} are the replacement for the deprecated and removed CapacityController interface. - * EvictionAttributes describe the {@link EvictionAlgorithm} and the {@link EvictionAction} - * as well as the various conditions under which the algorithm perform the action - * e.g. when the maximum number of entries has been reached or - * the maximum percentage of JVM heap has been consumed. - * Setting <code>EvictionAttributes</code> installs an eviction controller - * on the Region instantiated with the associated RegionAttributes </dd> + * <dd>{@link EvictionAttributes} are the replacement for the deprecated and removed + * CapacityController interface. EvictionAttributes describe the {@link EvictionAlgorithm} and the + * {@link EvictionAction} as well as the various conditions under which the algorithm perform the + * action e.g. when the maximum number of entries has been reached or the maximum percentage of JVM + * heap has been consumed. Setting <code>EvictionAttributes</code> installs an eviction controller + * on the Region instantiated with the associated RegionAttributes</dd> * * <dt>KeyConstraint [<em>default:</em> <code>null</code>, meaning no constraint]</dt> - * <dd>The Class to constrain the keys to in the region.<br> - * {@link #setKeyConstraint} {@link RegionAttributes#getKeyConstraint}</dd> + * <dd>The Class to constrain the keys to in the region.<br> + * {@link #setKeyConstraint} {@link RegionAttributes#getKeyConstraint}</dd> * * <dt>ValueConstraint [<em>default:</em> <code>null</code>, meaning no constraint]</dt> - * <dd>The Class to constrain the values to in the region. In addition to the - * utility of this for applications in general, a <code>valueConstraint</code> - * is helpful for compiling queries.<br> - * {@link #setValueConstraint} {@link RegionAttributes#getValueConstraint}</dd> + * <dd>The Class to constrain the values to in the region. In addition to the utility of this for + * applications in general, a <code>valueConstraint</code> is helpful for compiling queries.<br> + * {@link #setValueConstraint} {@link RegionAttributes#getValueConstraint}</dd> * * <dt>InitialCapacity [<em>default:</em> <code>16</code>]</dt> * <dd>The initial capacity of the map used for storing the entries. <br> @@ -204,156 +183,137 @@ import org.apache.geode.internal.i18n.LocalizedStrings; * * <dt>LoadFactor [<em>default:</em> <code>0.75</code>]</dt> * <dd>The load factor of the map used for storing the entries. <br> - * {@link java.util.HashMap} {@link #setLoadFactor} - * {@link RegionAttributes#getLoadFactor}</dd> + * {@link java.util.HashMap} {@link #setLoadFactor} {@link RegionAttributes#getLoadFactor}</dd> * * <dt>ConcurrencyLevel [<em>default:</em> <code>16</code>]</dt> - * <dd>The allowed concurrency among updates to values in the region is guided - * by the <tt>concurrencyLevel</tt>, which is used as a hint for internal - * sizing. The actual concurrency will vary. Ideally, you should choose a value - * to accommodate as many threads as will ever concurrently modify values in the - * region. Using a significantly higher value than you need can waste space and - * time, and a significantly lower value can lead to thread contention. But - * overestimates and underestimates within an order of magnitude do not usually - * have much noticeable impact. A value of one is appropriate when it is known - * that only one thread will modify and all others will only read. <br> - * {@link #setConcurrencyLevel} {@link RegionAttributes#getConcurrencyLevel} - * </dd> + * <dd>The allowed concurrency among updates to values in the region is guided by the + * <tt>concurrencyLevel</tt>, which is used as a hint for internal sizing. The actual concurrency + * will vary. Ideally, you should choose a value to accommodate as many threads as will ever + * concurrently modify values in the region. Using a significantly higher value than you need can + * waste space and time, and a significantly lower value can lead to thread contention. But + * overestimates and underestimates within an order of magnitude do not usually have much noticeable + * impact. A value of one is appropriate when it is known that only one thread will modify and all + * others will only read. <br> + * {@link #setConcurrencyLevel} {@link RegionAttributes#getConcurrencyLevel}</dd> * * <dt>ConcurrencyChecksEnabled [<em>default:</em> <code>false</code>]</dt> - * <dd>Enables a distributed versioning algorithm that detects concurrency - * conflicts in regions and ensures that changes to an - * entry are not applied in a different order in other members. This can - * cause operations to be conflated, so that some cache listeners may see - * an event while others do not, but it guarantees that the system will - * be consistent. - * </dd> + * <dd>Enables a distributed versioning algorithm that detects concurrency conflicts in regions and + * ensures that changes to an entry are not applied in a different order in other members. This can + * cause operations to be conflated, so that some cache listeners may see an event while others do + * not, but it guarantees that the system will be consistent.</dd> * * <dt>StatisticsEnabled [<em>default:</em> <code>false</code>]</dt> - * <dd>Whether statistics are enabled for this region. The default is disabled, - * which conserves on memory. <br> - * {@link #setStatisticsEnabled} {@link RegionAttributes#getStatisticsEnabled} - * </dd> + * <dd>Whether statistics are enabled for this region. The default is disabled, which conserves on + * memory. <br> + * {@link #setStatisticsEnabled} {@link RegionAttributes#getStatisticsEnabled}</dd> * * <dt>IgnoreJTA [<em>default:</em> <code>false</code>]</dt> - * <dd>Whether JTA transactions are ignored for this region. The - * default is to look for and join JTA transactions for operations - * performed on a region. + * <dd>Whether JTA transactions are ignored for this region. The default is to look for and join JTA + * transactions for operations performed on a region. * * <dt>DiskStoreName [<em>default:</em> <code>null</code>, meaning no disk store]</dt> - * <dd>If not <code>null</code> then this region will write its data - * to the named {@link DiskStore}.<br> - * {@link #setDiskStoreName} {@link RegionAttributes#getDiskStoreName}</dd> + * <dd>If not <code>null</code> then this region will write its data to the named + * {@link DiskStore}.<br> + * {@link #setDiskStoreName} {@link RegionAttributes#getDiskStoreName}</dd> * * <dt>DiskSynchronous [<em>default:</em> <code>true</code>]</dt> - * <dd>If <code>true</code> then any writes to disk done for this region - * will be done synchronously. This means that they will be in the file system - * buffer before the operation doing the write returns.<br> - * If <code>false</code> then any writes to disk done for this region - * will be done asynchronously. This means that they are queued up to be written - * and when they are actually written to the file system buffer is determined - * by the region's {@link DiskStore} configuration. - * Asynchronous writes will be conflated if the same entry is written while a - * previous operation for the same entry is still in the queue.<br> - * {@link #setDiskSynchronous} {@link RegionAttributes#isDiskSynchronous}</dd> - + * <dd>If <code>true</code> then any writes to disk done for this region will be done synchronously. + * This means that they will be in the file system buffer before the operation doing the write + * returns.<br> + * If <code>false</code> then any writes to disk done for this region will be done asynchronously. + * This means that they are queued up to be written and when they are actually written to the file + * system buffer is determined by the region's {@link DiskStore} configuration. Asynchronous writes + * will be conflated if the same entry is written while a previous operation for the same entry is + * still in the queue.<br> + * {@link #setDiskSynchronous} {@link RegionAttributes#isDiskSynchronous}</dd> + * * <dt>PersistBackup [<em>default:</em> <code>false</code>]</dt> - * <dd>Whether or not a persistent backup should be made of the - * region.<br> - * {@link #setPersistBackup} {@link RegionAttributes#getPersistBackup}</dd> - * <dd><em>Deprecated</em>, use {@link DataPolicy#PERSISTENT_REPLICATE} or {@link DataPolicy#PERSISTENT_PARTITION} instead.</dd> + * <dd>Whether or not a persistent backup should be made of the region.<br> + * {@link #setPersistBackup} {@link RegionAttributes#getPersistBackup}</dd> + * <dd><em>Deprecated</em>, use {@link DataPolicy#PERSISTENT_REPLICATE} or + * {@link DataPolicy#PERSISTENT_PARTITION} instead.</dd> * - * <dt>DiskWriteAttributes [<em>default:</em> Asynchronously write to - * disk every second (a <code>timeInterval</code> of 1000 and a - * <code>byteThreshold</codE> of 0). <code>rollOplogs</code> is set to true and - * <code>maxOplogSize</code> is set to 1024 MB]</dt> - * <dd>How region data should be written to disk. Determines - * whether data should be written synchronously or asynchronously. - * Data that is written asynchronously can be written at a certain - * {@linkplain DiskWriteAttributes#getTimeInterval time interval} - * or once a certain number of {@linkplain - * DiskWriteAttributes#getBytesThreshold bytes of data} have been - * enqueued.<br> - * {@link DiskWriteAttributes} {@link #setDiskWriteAttributes} {@link RegionAttributes#getDiskWriteAttributes}</dd> - * <dd><em>Deprecated</em>, use {@link #setDiskStoreName} and {@link #setDiskSynchronous} instead.</dd> + * <dt>DiskWriteAttributes [<em>default:</em> Asynchronously write to disk every second (a + * <code>timeInterval</code> of 1000 and a <code>byteThreshold</codE> of 0). <code>rollOplogs</code> + * is set to true and <code>maxOplogSize</code> is set to 1024 MB]</dt> + * <dd>How region data should be written to disk. Determines whether data should be written + * synchronously or asynchronously. Data that is written asynchronously can be written at a certain + * {@linkplain DiskWriteAttributes#getTimeInterval time interval} or once a certain number of + * {@linkplain DiskWriteAttributes#getBytesThreshold bytes of data} have been enqueued.<br> + * {@link DiskWriteAttributes} {@link #setDiskWriteAttributes} + * {@link RegionAttributes#getDiskWriteAttributes}</dd> + * <dd><em>Deprecated</em>, use {@link #setDiskStoreName} and {@link #setDiskSynchronous} + * instead.</dd> * - * <dt>DiskDirs [<em>default:</em> Current working directory (<code>user.dir</code> {@linkplain System#getProperties system property})]</dt> - * <dd>The directories to which the region's data are written. If - * multiple directories are used, GemFire will attempt to distribute the - * data evenly among them. <br> - * {@link #setDiskDirs} {@link RegionAttributes#getDiskDirs}</dd> - * <dd><em>Deprecated</em>, use {@link #setDiskStoreName} instead.</dd> + * <dt>DiskDirs [<em>default:</em> Current working directory (<code>user.dir</code> + * {@linkplain System#getProperties system property})]</dt> + * <dd>The directories to which the region's data are written. If multiple directories are used, + * GemFire will attempt to distribute the data evenly among them. <br> + * {@link #setDiskDirs} {@link RegionAttributes#getDiskDirs}</dd> + * <dd><em>Deprecated</em>, use {@link #setDiskStoreName} instead.</dd> * * <dt>DiskDirSizes [<em>default:</em> 10240 MB]</dt> - * <dd> The size of the directory to which region's data is written.<br> + * <dd>The size of the directory to which region's data is written.<br> * {@link #setDiskDirsAndSizes} {@link RegionAttributes#getDiskDirSizes}</dd> * <dd><em>Deprecated</em>, use {@link #setDiskStoreName} instead.</dd> * * - * <dt>{@link PartitionAttributes} [<em>default:</em> <code>null</code>, meaning no region partitioning]</dt> - * <dd>How region data is partitioned among the members of the - * distributed system. - * <br> - * {@link #setPartitionAttributes} {@link RegionAttributes#getPartitionAttributes}</dd> + * <dt>{@link PartitionAttributes} [<em>default:</em> <code>null</code>, meaning no region + * partitioning]</dt> + * <dd>How region data is partitioned among the members of the distributed system. <br> + * {@link #setPartitionAttributes} {@link RegionAttributes#getPartitionAttributes}</dd> * * <dt>{@link MembershipAttributes} [<em>default:</em> no required roles]</dt> - * <dd>How access to the region is affected when one or more required roles - * are missing from the region membership. - * <br> - * {@link #setMembershipAttributes} {@link RegionAttributes#getMembershipAttributes}</dd> - * <dd><em>Deprecated</em>, this API is scheduled to be removed</dd> - * </dt> + * <dd>How access to the region is affected when one or more required roles are missing from the + * region membership. <br> + * {@link #setMembershipAttributes} {@link RegionAttributes#getMembershipAttributes}</dd> + * <dd><em>Deprecated</em>, this API is scheduled to be removed</dd></dt> * </dl> * * <h4>Locking</h4> * <dl> * <dt>LockGrantor [<em>default:</em> <code>false</code>]</dt> - * <dd>Should this process become lock grantor for the region?</dd><br> - * {@link #setLockGrantor} {@link RegionAttributes#isLockGrantor} - * {@link Region#becomeLockGrantor} + * <dd>Should this process become lock grantor for the region?</dd><br> + * {@link #setLockGrantor} {@link RegionAttributes#isLockGrantor} {@link Region#becomeLockGrantor} * </dl> * * <h4>Querying</h4> * <dl> * <dt>IndexMaintenanceSynchronous [<em>default:</em> <code>false</code>]</dt> - * <dd>Are indexes built over in this region updated - * synchronously when the underlying data is - * modified?</dd><br> - * {@link #setIndexMaintenanceSynchronous} {@link - * RegionAttributes#getIndexMaintenanceSynchronous} + * <dd>Are indexes built over in this region updated synchronously when the underlying data is + * modified?</dd><br> + * {@link #setIndexMaintenanceSynchronous} {@link RegionAttributes#getIndexMaintenanceSynchronous} * </dl> * - * <p>Note that the RegionAttributes are not distributed with the region. + * <p> + * Note that the RegionAttributes are not distributed with the region. * - * <a name="compatibility"><h3>Compatibility Rules</h3> - * <h4>RegionAttributes Creation Constraints</h4> - * If any of the following compatibility rules are violated when - * {@link #create}</code> is called then an - * {@link IllegalStateException} is thrown. + * <a name="compatibility"> + * <h3>Compatibility Rules</h3> + * <h4>RegionAttributes Creation Constraints</h4> If any of the following compatibility rules are + * violated when {@link #create}</code> is called then an {@link IllegalStateException} is thrown. * See {@link #validateAttributes}. * - * <a name="creationConstraints"><h3>Creation Constraints</h3> + * <a name="creationConstraints"> + * <h3>Creation Constraints</h3> * <h4>Region Creation Constraints on RegionAttributes</h4> * - * If any of the following rules are violated when {@link - * Region#createSubregion createSubregion} or {@link Cache#createRegion - * createRegion} are called, then an - * <code>IllegalStateException</code> is thrown. + * If any of the following rules are violated when {@link Region#createSubregion createSubregion} or + * {@link Cache#createRegion createRegion} are called, then an <code>IllegalStateException</code> is + * thrown. * * <ul> * <li>A region with <code>Scope.LOCAL</code> can only have subregions with * <code>Scope.LOCAL</code>.</li> - * <li><code>Scope.GLOBAL</code> is illegal if there is any other cache in - * the distributed system that has the same region with - * <code>Scope.DISTRIBUTED_NO_ACK</code> or <code>Scope.DISTRIBUTED_ACK</code>. - * </li> - * <li><code>Scope.DISTRIBUTED_ACK</code> is illegal if there is any other - * cache in the distributed system that has the same region with - * <code>Scope.DISTRIBUTED_NO_ACK</code> or <code>Scope.GLOBAL</code>. - * </li> - * <li><code>Scope.DISTRIBUTED_NO_ACK</code> is illegal if there is any other - * cache in the distributed system that has the same region with - * <code>Scope.DISTRIBUTED_ACK</code> or <code>Scope.GLOBAL</code>.</li> + * <li><code>Scope.GLOBAL</code> is illegal if there is any other cache in the distributed system + * that has the same region with <code>Scope.DISTRIBUTED_NO_ACK</code> or + * <code>Scope.DISTRIBUTED_ACK</code>.</li> + * <li><code>Scope.DISTRIBUTED_ACK</code> is illegal if there is any other cache in the distributed + * system that has the same region with <code>Scope.DISTRIBUTED_NO_ACK</code> or + * <code>Scope.GLOBAL</code>.</li> + * <li><code>Scope.DISTRIBUTED_NO_ACK</code> is illegal if there is any other cache in the + * distributed system that has the same region with <code>Scope.DISTRIBUTED_ACK</code> or + * <code>Scope.GLOBAL</code>.</li> * </ul> * * @see RegionAttributes @@ -361,130 +321,126 @@ import org.apache.geode.internal.i18n.LocalizedStrings; * @see Region#createSubregion(String, RegionAttributes) * * @since GemFire 3.0 - * @deprecated as of 6.5 use {@link Cache#createRegionFactory(RegionShortcut)} or {@link ClientCache#createClientRegionFactory(ClientRegionShortcut)} instead. + * @deprecated as of 6.5 use {@link Cache#createRegionFactory(RegionShortcut)} or + * {@link ClientCache#createClientRegionFactory(ClientRegionShortcut)} instead. */ @SuppressWarnings("synthetic-access") -public class AttributesFactory<K,V> { - private final RegionAttributesImpl<K,V> regionAttributes = new RegionAttributesImpl<K,V>(); +public class AttributesFactory<K, V> { + private final RegionAttributesImpl<K, V> regionAttributes = new RegionAttributesImpl<K, V>(); /** * The default disk synchronous write setting - * <p>Current value: <code>true</code> each. + * <p> + * Current value: <code>true</code> each. + * * @since GemFire 6.5 */ public static final boolean DEFAULT_DISK_SYNCHRONOUS = true; - + /** - * Creates a new instance of AttributesFactory ready to create a - * <code>RegionAttributes</code> with default settings. + * Creates a new instance of AttributesFactory ready to create a <code>RegionAttributes</code> + * with default settings. */ - public AttributesFactory() { - } + public AttributesFactory() {} /** - * Creates a new instance of AttributesFactory ready to create a - * <code>RegionAttributes</code> with the same settings as those in the - * specified <code>RegionAttributes</code>. + * Creates a new instance of AttributesFactory ready to create a <code>RegionAttributes</code> + * with the same settings as those in the specified <code>RegionAttributes</code>. * - * @param regionAttributes - * the <code>RegionAttributes</code> used to initialize this - * AttributesFactory + * @param regionAttributes the <code>RegionAttributes</code> used to initialize this + * AttributesFactory */ @SuppressWarnings("deprecation") - public AttributesFactory(RegionAttributes<K,V> regionAttributes) { + public AttributesFactory(RegionAttributes<K, V> regionAttributes) { synchronized (this.regionAttributes) { - this.regionAttributes.cacheListeners = new ArrayList<CacheListener<K,V>>(Arrays.asList(regionAttributes.getCacheListeners())); + this.regionAttributes.cacheListeners = + new ArrayList<CacheListener<K, V>>(Arrays.asList(regionAttributes.getCacheListeners())); } this.regionAttributes.cacheLoader = regionAttributes.getCacheLoader(); this.regionAttributes.cacheWriter = regionAttributes.getCacheWriter(); - this.regionAttributes.regionTimeToLive = regionAttributes - .getRegionTimeToLive().getTimeout(); - this.regionAttributes.regionTimeToLiveExpirationAction = regionAttributes - .getRegionTimeToLive().getAction(); - this.regionAttributes.regionIdleTimeout = regionAttributes - .getRegionIdleTimeout().getTimeout(); - this.regionAttributes.regionIdleTimeoutExpirationAction = regionAttributes - .getRegionIdleTimeout().getAction(); - - this.regionAttributes.entryTimeToLive = regionAttributes - .getEntryTimeToLive().getTimeout(); - this.regionAttributes.entryTimeToLiveExpirationAction = regionAttributes - .getEntryTimeToLive().getAction(); - this.regionAttributes.customEntryTimeToLive = regionAttributes - .getCustomEntryTimeToLive(); - this.regionAttributes.entryIdleTimeout = regionAttributes - .getEntryIdleTimeout().getTimeout(); - this.regionAttributes.entryIdleTimeoutExpirationAction = regionAttributes - .getEntryIdleTimeout().getAction(); - this.regionAttributes.customEntryIdleTimeout = regionAttributes - .getCustomEntryIdleTimeout(); - + this.regionAttributes.regionTimeToLive = regionAttributes.getRegionTimeToLive().getTimeout(); + this.regionAttributes.regionTimeToLiveExpirationAction = + regionAttributes.getRegionTimeToLive().getAction(); + this.regionAttributes.regionIdleTimeout = regionAttributes.getRegionIdleTimeout().getTimeout(); + this.regionAttributes.regionIdleTimeoutExpirationAction = + regionAttributes.getRegionIdleTimeout().getAction(); + + this.regionAttributes.entryTimeToLive = regionAttributes.getEntryTimeToLive().getTimeout(); + this.regionAttributes.entryTimeToLiveExpirationAction = + regionAttributes.getEntryTimeToLive().getAction(); + this.regionAttributes.customEntryTimeToLive = regionAttributes.getCustomEntryTimeToLive(); + this.regionAttributes.entryIdleTimeout = regionAttributes.getEntryIdleTimeout().getTimeout(); + this.regionAttributes.entryIdleTimeoutExpirationAction = + regionAttributes.getEntryIdleTimeout().getAction(); + this.regionAttributes.customEntryIdleTimeout = regionAttributes.getCustomEntryIdleTimeout(); + this.regionAttributes.scope = regionAttributes.getScope(); this.regionAttributes.dataPolicy = regionAttributes.getDataPolicy(); this.regionAttributes.statisticsEnabled = regionAttributes.getStatisticsEnabled(); this.regionAttributes.ignoreJTA = regionAttributes.getIgnoreJTA(); this.regionAttributes.keyConstraint = regionAttributes.getKeyConstraint(); - this.regionAttributes.valueConstraint = regionAttributes - .getValueConstraint(); - this.regionAttributes.initialCapacity = regionAttributes - .getInitialCapacity(); + this.regionAttributes.valueConstraint = regionAttributes.getValueConstraint(); + this.regionAttributes.initialCapacity = regionAttributes.getInitialCapacity(); this.regionAttributes.loadFactor = regionAttributes.getLoadFactor(); - this.regionAttributes.concurrencyLevel = regionAttributes - .getConcurrencyLevel(); + this.regionAttributes.concurrencyLevel = regionAttributes.getConcurrencyLevel(); this.regionAttributes.concurrencyChecksEnabled = regionAttributes.getConcurrencyChecksEnabled(); this.regionAttributes.earlyAck = regionAttributes.getEarlyAck(); this.regionAttributes.diskStoreName = regionAttributes.getDiskStoreName(); if (this.regionAttributes.diskStoreName == null) { - this.regionAttributes.diskWriteAttributes = regionAttributes - .getDiskWriteAttributes(); + this.regionAttributes.diskWriteAttributes = regionAttributes.getDiskWriteAttributes(); this.regionAttributes.diskDirs = regionAttributes.getDiskDirs(); this.regionAttributes.diskSizes = regionAttributes.getDiskDirSizes(); } this.regionAttributes.diskSynchronous = regionAttributes.isDiskSynchronous(); - this.regionAttributes.indexMaintenanceSynchronous = regionAttributes - .getIndexMaintenanceSynchronous(); - this.regionAttributes.partitionAttributes = regionAttributes - .getPartitionAttributes(); - this.regionAttributes.evictionAttributes = (EvictionAttributesImpl)regionAttributes - .getEvictionAttributes(); + this.regionAttributes.indexMaintenanceSynchronous = + regionAttributes.getIndexMaintenanceSynchronous(); + this.regionAttributes.partitionAttributes = regionAttributes.getPartitionAttributes(); + this.regionAttributes.evictionAttributes = + (EvictionAttributesImpl) regionAttributes.getEvictionAttributes(); this.regionAttributes.membershipAttributes = regionAttributes.getMembershipAttributes(); this.regionAttributes.subscriptionAttributes = regionAttributes.getSubscriptionAttributes(); - this.regionAttributes.evictionAttributes = (EvictionAttributesImpl) regionAttributes.getEvictionAttributes(); + this.regionAttributes.evictionAttributes = + (EvictionAttributesImpl) regionAttributes.getEvictionAttributes(); this.regionAttributes.publisher = regionAttributes.getPublisher(); this.regionAttributes.enableAsyncConflation = regionAttributes.getEnableAsyncConflation(); - this.regionAttributes.enableSubscriptionConflation = regionAttributes.getEnableSubscriptionConflation(); + this.regionAttributes.enableSubscriptionConflation = + regionAttributes.getEnableSubscriptionConflation(); this.regionAttributes.poolName = regionAttributes.getPoolName(); this.regionAttributes.isCloningEnabled = regionAttributes.getCloningEnabled(); this.regionAttributes.multicastEnabled = regionAttributes.getMulticastEnabled(); - this.regionAttributes.gatewaySenderIds = new CopyOnWriteArraySet<String>(regionAttributes.getGatewaySenderIds()); - this.regionAttributes.asyncEventQueueIds = new CopyOnWriteArraySet<String>(regionAttributes.getAsyncEventQueueIds()); + this.regionAttributes.gatewaySenderIds = + new CopyOnWriteArraySet<String>(regionAttributes.getGatewaySenderIds()); + this.regionAttributes.asyncEventQueueIds = + new CopyOnWriteArraySet<String>(regionAttributes.getAsyncEventQueueIds()); this.regionAttributes.isLockGrantor = regionAttributes.isLockGrantor(); // fix for bug 47067 if (regionAttributes instanceof UserSpecifiedRegionAttributes) { - this.regionAttributes.setIndexes(((UserSpecifiedRegionAttributes<K,V>) regionAttributes).getIndexes()); + this.regionAttributes + .setIndexes(((UserSpecifiedRegionAttributes<K, V>) regionAttributes).getIndexes()); } if (regionAttributes instanceof UserSpecifiedRegionAttributes) { - // Selectively set has* fields to true, propigating those non-default + // Selectively set has* fields to true, propigating those non-default // (aka user specified) fields as such - UserSpecifiedRegionAttributes<K,V> nonDefault = (UserSpecifiedRegionAttributes<K,V>) regionAttributes; + UserSpecifiedRegionAttributes<K, V> nonDefault = + (UserSpecifiedRegionAttributes<K, V>) regionAttributes; this.regionAttributes.initHasFields(nonDefault); this.regionAttributes.requiresPoolName = nonDefault.requiresPoolName; } else { // Set all fields to false, essentially starting with a new set of defaults this.regionAttributes.setAllHasFields(false); - - - -// -// // Special Partitioned Region handling by -// // pretending the user didn't explicitly ask for the default scope -// if (AbstractRegion.DEFAULT_SCOPE.equals(this.regionAttributes.getScope())) { -// this.regionAttributes.setHasScope(false); -// } - } - + + + + // + // // Special Partitioned Region handling by + // // pretending the user didn't explicitly ask for the default scope + // if (AbstractRegion.DEFAULT_SCOPE.equals(this.regionAttributes.getScope())) { + // this.regionAttributes.setHasScope(false); + // } + } + this.regionAttributes.compressor = regionAttributes.getCompressor(); this.regionAttributes.offHeap = regionAttributes.getOffHeap(); } @@ -494,12 +450,10 @@ public class AttributesFactory<K,V> { /** * Sets the cache loader for the next <code>RegionAttributes</code> created. * - * @param cacheLoader - * the cache loader or null if no loader + * @param cacheLoader the cache loader or null if no loader * @throws IllegalStateException if this region has a {@link #setPoolName pool name set} */ - public void setCacheLoader(CacheLoader<K,V> cacheLoader) - { + public void setCacheLoader(CacheLoader<K, V> cacheLoader) { this.regionAttributes.cacheLoader = cacheLoader; this.regionAttributes.setHasCacheLoader(true); } @@ -507,28 +461,28 @@ public class AttributesFactory<K,V> { /** * Sets the cache writer for the next <code>RegionAttributes</code> created. * - * @param cacheWriter - * the cache writer or null if no cache writer + * @param cacheWriter the cache writer or null if no cache writer * @throws IllegalStateException if this region has a {@link #setPoolName pool name set} */ - public void setCacheWriter(CacheWriter<K,V> cacheWriter) - { + public void setCacheWriter(CacheWriter<K, V> cacheWriter) { this.regionAttributes.cacheWriter = cacheWriter; this.regionAttributes.setHasCacheWriter(true); } - /** Sets the CacheListener for the next <code>RegionAttributes</code> created. - * Any existing cache listeners on this factory are removed. + /** + * Sets the CacheListener for the next <code>RegionAttributes</code> created. Any existing cache + * listeners on this factory are removed. + * * @param aListener a user defined CacheListener, null if no listener * @deprecated as of GemFire 5.0, use {@link #addCacheListener} instead. */ @Deprecated - public void setCacheListener(CacheListener<K,V> aListener) { - ArrayList<CacheListener<K,V>> col; + public void setCacheListener(CacheListener<K, V> aListener) { + ArrayList<CacheListener<K, V>> col; if (aListener == null) { col = null; } else { - col = new ArrayList<CacheListener<K,V>>(1); + col = new ArrayList<CacheListener<K, V>>(1); col.add(aListener); } synchronized (this.regionAttributes) { @@ -536,36 +490,44 @@ public class AttributesFactory<K,V> { } this.regionAttributes.setHasCacheListeners(true); } + /** * Adds a cache listener to the end of the list of cache listeners on this factory. + * * @param aListener the cache listener to add to the factory. * @throws IllegalArgumentException if <code>aListener</code> is null * @since GemFire 5.0 */ - public void addCacheListener(CacheListener<K,V> aListener) { + public void addCacheListener(CacheListener<K, V> aListener) { if (aListener == null) { - throw new IllegalArgumentException(LocalizedStrings.AttributesFactory_ADDCACHELISTENER_PARAMETER_WAS_NULL.toLocalizedString()); + throw new IllegalArgumentException( + LocalizedStrings.AttributesFactory_ADDCACHELISTENER_PARAMETER_WAS_NULL + .toLocalizedString()); } synchronized (this.regionAttributes) { this.regionAttributes.addCacheListener(aListener); } } + /** * Removes all cache listeners and then adds each listener in the specified array. + * * @param newListeners a possibly null or empty array of listeners to add to this factory. * @throws IllegalArgumentException if the <code>newListeners</code> array has a null element * @since GemFire 5.0 */ - public void initCacheListeners(CacheListener<K,V>[] newListeners) { + public void initCacheListeners(CacheListener<K, V>[] newListeners) { synchronized (this.regionAttributes) { if (newListeners == null || newListeners.length == 0) { this.regionAttributes.cacheListeners = null; } else { - List<CacheListener<K,V>> nl = Arrays.asList(newListeners); + List<CacheListener<K, V>> nl = Arrays.asList(newListeners); if (nl.contains(null)) { - throw new IllegalArgumentException(LocalizedStrings.AttributesFactory_INITCACHELISTENERS_PARAMETER_HAD_A_NULL_ELEMENT.toLocalizedString()); + throw new IllegalArgumentException( + LocalizedStrings.AttributesFactory_INITCACHELISTENERS_PARAMETER_HAD_A_NULL_ELEMENT + .toLocalizedString()); } - this.regionAttributes.cacheListeners = new ArrayList<CacheListener<K,V>>(nl); + this.regionAttributes.cacheListeners = new ArrayList<CacheListener<K, V>>(nl); } } this.regionAttributes.setHasCacheListeners(true); @@ -576,126 +538,107 @@ public class AttributesFactory<K,V> { /** * Sets the idleTimeout expiration attributes for region entries for the next - * <code>RegionAttributes</code> created. - * Default is 0 which indicates no expiration of this type. + * <code>RegionAttributes</code> created. Default is 0 which indicates no expiration of this type. * - * @param idleTimeout - * the idleTimeout ExpirationAttributes for entries in this region - * @throws IllegalArgumentException - * if idleTimeout is null + * @param idleTimeout the idleTimeout ExpirationAttributes for entries in this region + * @throws IllegalArgumentException if idleTimeout is null */ - public void setEntryIdleTimeout(ExpirationAttributes idleTimeout) - { + public void setEntryIdleTimeout(ExpirationAttributes idleTimeout) { if (idleTimeout == null) { - throw new IllegalArgumentException(LocalizedStrings.AttributesFactory_IDLETIMEOUT_MUST_NOT_BE_NULL.toLocalizedString()); + throw new IllegalArgumentException( + LocalizedStrings.AttributesFactory_IDLETIMEOUT_MUST_NOT_BE_NULL.toLocalizedString()); } this.regionAttributes.entryIdleTimeout = idleTimeout.getTimeout(); - this.regionAttributes.entryIdleTimeoutExpirationAction = idleTimeout - .getAction(); + this.regionAttributes.entryIdleTimeoutExpirationAction = idleTimeout.getAction(); this.regionAttributes.setHasEntryIdleTimeout(true); } /** - * Sets the idleTimeout CustomExpiry for the next <code>RegionAttributes</code> - * created. + * Sets the idleTimeout CustomExpiry for the next <code>RegionAttributes</code> created. * * @param custom the CustomExpiry to use; null means none will be used. */ - public void setCustomEntryIdleTimeout(CustomExpiry<K,V> custom) { + public void setCustomEntryIdleTimeout(CustomExpiry<K, V> custom) { this.regionAttributes.customEntryIdleTimeout = custom; this.regionAttributes.setHasCustomEntryIdleTimeout(true); } - + /** * Sets the timeToLive expiration attributes for region entries for the next - * <code>RegionAttributes</code> created. - * Default is 0 which indicates no expiration of this type. + * <code>RegionAttributes</code> created. Default is 0 which indicates no expiration of this type. * - * @param timeToLive - * the timeToLive ExpirationAttributes for entries in this region - * @throws IllegalArgumentException - * if timeToLive is null + * @param timeToLive the timeToLive ExpirationAttributes for entries in this region + * @throws IllegalArgumentException if timeToLive is null */ - public void setEntryTimeToLive(ExpirationAttributes timeToLive) - { + public void setEntryTimeToLive(ExpirationAttributes timeToLive) { if (timeToLive == null) { - throw new IllegalArgumentException(LocalizedStrings.AttributesFactory_TIMETOLIVE_MUST_NOT_BE_NULL.toLocalizedString()); + throw new IllegalArgumentException( + LocalizedStrings.AttributesFactory_TIMETOLIVE_MUST_NOT_BE_NULL.toLocalizedString()); } this.regionAttributes.entryTimeToLive = timeToLive.getTimeout(); - this.regionAttributes.entryTimeToLiveExpirationAction = timeToLive - .getAction(); + this.regionAttributes.entryTimeToLiveExpirationAction = timeToLive.getAction(); this.regionAttributes.setHasEntryTimeToLive(true); } /** - * Sets the custom timeToLive for the next <code>RegionAttributes</code> - * created. + * Sets the custom timeToLive for the next <code>RegionAttributes</code> created. * - * @param custom the CustomExpiry to use, none if the default for the region - * is to be used. + * @param custom the CustomExpiry to use, none if the default for the region is to be used. */ - public void setCustomEntryTimeToLive(CustomExpiry<K,V> custom) { + public void setCustomEntryTimeToLive(CustomExpiry<K, V> custom) { this.regionAttributes.customEntryTimeToLive = custom; this.regionAttributes.setHasCustomEntryTimeToLive(true); } - + /** - * Sets the idleTimeout expiration attributes for the region itself for the - * next <code>RegionAttributes</code> created. - * Default is 0 which indicates no expiration of this type is set. + * Sets the idleTimeout expiration attributes for the region itself for the next + * <code>RegionAttributes</code> created. Default is 0 which indicates no expiration of this type + * is set. * - * @param idleTimeout - * the ExpirationAttributes for this region idleTimeout - * @throws IllegalArgumentException - * if idleTimeout is null + * @param idleTimeout the ExpirationAttributes for this region idleTimeout + * @throws IllegalArgumentException if idleTimeout is null */ - public void setRegionIdleTimeout(ExpirationAttributes idleTimeout) - { + public void setRegionIdleTimeout(ExpirationAttributes idleTimeout) { if (idleTimeout == null) { - throw new IllegalArgumentException(LocalizedStrings.AttributesFactory_IDLETIMEOUT_MUST_NOT_BE_NULL.toLocalizedString()); + throw new IllegalArgumentException( + LocalizedStrings.AttributesFactory_IDLETIMEOUT_MUST_NOT_BE_NULL.toLocalizedString()); } this.regionAttributes.regionIdleTimeout = idleTimeout.getTimeout(); - this.regionAttributes.regionIdleTimeoutExpirationAction = idleTimeout - .getAction(); + this.regionAttributes.regionIdleTimeoutExpirationAction = idleTimeout.getAction(); this.regionAttributes.setHasRegionIdleTimeout(true); } - + /** - * Sets the timeToLive expiration attributes for the region itself for the - * next <code>RegionAttributes</code> created. - * Default is 0 i.e. no expiration of this type. + * Sets the timeToLive expiration attributes for the region itself for the next + * <code>RegionAttributes</code> created. Default is 0 i.e. no expiration of this type. * - * @param timeToLive - * the ExpirationAttributes for this region timeToLive - * @throws IllegalArgumentException - * if timeToLive is null + * @param timeToLive the ExpirationAttributes for this region timeToLive + * @throws IllegalArgumentException if timeToLive is null */ - public void setRegionTimeToLive(ExpirationAttributes timeToLive) - { + public void setRegionTimeToLive(ExpirationAttributes timeToLive) { if (timeToLive == null) { - throw new IllegalArgumentException(LocalizedStrings.AttributesFactory_TIMETOLIVE_MUST_NOT_BE_NULL.toLocalizedString()); + throw new IllegalArgumentException( + LocalizedStrings.AttributesFactory_TIMETOLIVE_MUST_NOT_BE_NULL.toLocalizedString()); } this.regionAttributes.regionTimeToLive = timeToLive.getTimeout(); - this.regionAttributes.regionTimeToLiveExpirationAction = timeToLive - .getAction(); + this.regionAttributes.regionTimeToLiveExpirationAction = timeToLive.getAction(); this.regionAttributes.setHasRegionTimeToLive(true); } // DISTRIBUTION ATTRIBUTES /** - * Sets the scope for the next <code>RegionAttributes</code> created. - * Default scope is DISTRIBUTED_NO_ACK. Refer gemfire documentation for more details on this. - * @param scopeType - * the type of Scope to use for the region - * @throws IllegalArgumentException - * if scopeType is null + * Sets the scope for the next <code>RegionAttributes</code> created. Default scope is + * DISTRIBUTED_NO_ACK. Refer gemfire documentation for more details on this. + * + * @param scopeType the type of Scope to use for the region + * @throws IllegalArgumentException if scopeType is null */ - public void setScope(Scope scopeType) - { + public void setScope(Scope scopeType) { if (scopeType == null) { - throw new IllegalArgumentException(LocalizedStrings.AttributesFactory_SCOPETYPE_MUST_NOT_BE_NULL.toLocalizedString()); + throw new IllegalArgumentException( + LocalizedStrings.AttributesFactory_SCOPETYPE_MUST_NOT_BE_NULL.toLocalizedString()); } this.regionAttributes.setScope(scopeType); } @@ -703,24 +646,25 @@ public class AttributesFactory<K,V> { // STORAGE ATTRIBUTES /** - * Sets the EvictionController for the next <code>RegionAttributes</code> - * created. Use one of the creation methods on {@link EvictionAttributes} e.g. - * {@link EvictionAttributes#createLRUHeapAttributes()} to create the desired - * instance for this <code>AttributesFactory</code> + * Sets the EvictionController for the next <code>RegionAttributes</code> created. Use one of the + * creation methods on {@link EvictionAttributes} e.g. + * {@link EvictionAttributes#createLRUHeapAttributes()} to create the desired instance for this + * <code>AttributesFactory</code> * - * @param evictAttrs - * Explains how and when eviction occurs in the Region. + * @param evictAttrs Explains how and when eviction occurs in the Region. */ - public void setEvictionAttributes(EvictionAttributes evictAttrs) { - if (evictAttrs != null) { - this.regionAttributes.evictionAttributes = (EvictionAttributesImpl) evictAttrs; - } else { - this.regionAttributes.evictionAttributes = new EvictionAttributesImpl(); - } - this.regionAttributes.setHasEvictionAttributes(true); - } - - /** Sets the mirror type for the next <code>RegionAttributes</code> created. + public void setEvictionAttributes(EvictionAttributes evictAttrs) { + if (evictAttrs != null) { + this.regionAttributes.evictionAttributes = (EvictionAttributesImpl) evictAttrs; + } else { + this.regionAttributes.evictionAttributes = new EvictionAttributesImpl(); + } + this.regionAttributes.setHasEvictionAttributes(true); + } + + /** + * Sets the mirror type for the next <code>RegionAttributes</code> created. + * * @param mirrorType The type of mirroring to use for the region * @throws IllegalArgumentException if mirrorType is null * @deprecated use {@link #setDataPolicy} instead. @@ -728,7 +672,8 @@ public class AttributesFactory<K,V> { @Deprecated public void setMirrorType(MirrorType mirrorType) { if (mirrorType == null) { - throw new IllegalArgumentException(LocalizedStrings.AttributesFactory_MIRRORTYPE_MUST_NOT_BE_NULL.toLocalizedString()); + throw new IllegalArgumentException( + LocalizedStrings.AttributesFactory_MIRRORTYPE_MUST_NOT_BE_NULL.toLocalizedString()); } DataPolicy dp = mirrorType.getDataPolicy(); if (dp.withReplication()) { @@ -745,19 +690,24 @@ public class AttributesFactory<K,V> { } } } - /** Sets the data policy for the next <code>RegionAttributes</code> created. - * Default data policy is 'Normal'. Please refer gemfire documentation for more details on this. + + /** + * Sets the data policy for the next <code>RegionAttributes</code> created. Default data policy is + * 'Normal'. Please refer gemfire documentation for more details on this. + * * @param dataPolicy The data policy to use for the region * @throws IllegalArgumentException if dataPolicy is null */ public void setDataPolicy(DataPolicy dataPolicy) { if (dataPolicy == null) { - throw new IllegalArgumentException(LocalizedStrings.AttributesFactory_DATAPOLICY_MUST_NOT_BE_NULL.toLocalizedString()); + throw new IllegalArgumentException( + LocalizedStrings.AttributesFactory_DATAPOLICY_MUST_NOT_BE_NULL.toLocalizedString()); } if (this.regionAttributes.partitionAttributes != null) { - if ( !PartitionedRegionHelper.ALLOWED_DATA_POLICIES.contains(dataPolicy) ) { - throw new IllegalStateException( LocalizedStrings.AttributesFactory_DATA_POLICIES_OTHER_THAN_0_ARE_NOT_SUPPORTED_FOR_PARTITIONED_REGIONS - .toLocalizedString(PartitionedRegionHelper.ALLOWED_DATA_POLICIES)); + if (!PartitionedRegionHelper.ALLOWED_DATA_POLICIES.contains(dataPolicy)) { + throw new IllegalStateException( + LocalizedStrings.AttributesFactory_DATA_POLICIES_OTHER_THAN_0_ARE_NOT_SUPPORTED_FOR_PARTITIONED_REGIONS + .toLocalizedString(PartitionedRegionHelper.ALLOWED_DATA_POLICIES)); } } this.regionAttributes.setDataPolicy(dataPolicy); @@ -765,32 +715,38 @@ public class AttributesFactory<K,V> { - /** Sets the key constraint for the next <code>RegionAttributes</code> created. - * Keys in the region will be constrained to this class (or subclass). - * Any attempt to store a key of an incompatible type in the region will - * cause a <code>ClassCastException</code> to be thrown. + /** + * Sets the key constraint for the next <code>RegionAttributes</code> created. Keys in the region + * will be constrained to this class (or subclass). Any attempt to store a key of an incompatible + * type in the region will cause a <code>ClassCastException</code> to be thrown. + * * @param keyConstraint The Class to constrain the keys to, or null if no constraint - * @throws IllegalArgumentException if <code>keyConstraint</code> is a class - * denoting a primitive type + * @throws IllegalArgumentException if <code>keyConstraint</code> is a class denoting a primitive + * type */ public void setKeyConstraint(Class<K> keyConstraint) { if (keyConstraint != null && keyConstraint.isPrimitive()) - throw new IllegalArgumentException(LocalizedStrings.AttributesFactory_KEYCONSTRAINT_MUST_NOT_BE_A_PRIMITIVE_TYPE.toLocalizedString()); + throw new IllegalArgumentException( + LocalizedStrings.AttributesFactory_KEYCONSTRAINT_MUST_NOT_BE_A_PRIMITIVE_TYPE + .toLocalizedString()); this.regionAttributes.keyConstraint = keyConstraint; this.regionAttributes.setHasKeyConstraint(true); } - /** Sets the value constraint for the next <code>RegionAttributes</code> created. - * Values in the region will be constrained to this class (or subclass). - * Any attempt to store a value of an incompatible type in the region will - * cause a <code>ClassCastException</code> to be thrown. + /** + * Sets the value constraint for the next <code>RegionAttributes</code> created. Values in the + * region will be constrained to this class (or subclass). Any attempt to store a value of an + * incompatible type in the region will cause a <code>ClassCastException</code> to be thrown. + * * @param valueConstraint The Class to constrain the values to, or null if no constraint - * @throws IllegalArgumentException if <code>valueConstraint</code> is a class - * denoting a primitive type + * @throws IllegalArgumentException if <code>valueConstraint</code> is a class denoting a + * primitive type */ public void setValueConstraint(Class<V> valueConstraint) { if (valueConstraint != null && valueConstraint.isPrimitive()) - throw new IllegalArgumentException(LocalizedStrings.AttributesFactory_VALUECONSTRAINT_MUST_NOT_BE_A_PRIMITIVE_TYPE.toLocalizedString()); + throw new IllegalArgumentException( + LocalizedStrings.AttributesFactory_VALUECONSTRAINT_MUST_NOT_BE_A_PRIMITIVE_TYPE + .toLocalizedString()); this.regionAttributes.valueConstraint = valueConstraint; this.regionAttributes.setHasValueConstraint(true); } @@ -798,52 +754,57 @@ public class AttributesFactory<K,V> { // MAP ATTRIBUTES - /** Sets the entry initial capacity for the next <code>RegionAttributes</code> - * created. This value - * is used in initializing the map that holds the entries. - * Default is 16. + /** + * Sets the entry initial capacity for the next <code>RegionAttributes</code> created. This value + * is used in initializing the map that holds the entries. Default is 16. + * * @param initialCapacity the initial capacity of the entry map * @throws IllegalArgumentException if initialCapacity is negative. * @see java.util.HashMap */ public void setInitialCapacity(int initialCapacity) { if (initialCapacity < 0) - throw new IllegalArgumentException(LocalizedStrings.AttributesFactory_INITIALCAPACITY_MUST_BE_0.toLocalizedString()); + throw new IllegalArgumentException( + LocalizedStrings.AttributesFactory_INITIALCAPACITY_MUST_BE_0.toLocalizedString()); this.regionAttributes.initialCapacity = initialCapacity; this.regionAttributes.setHasInitialCapacity(true); } - /** Sets the entry load factor for the next <code>RegionAttributes</code> - * created. This value is - * used in initializing the map that holds the entries. - * Default is 0.75. + /** + * Sets the entry load factor for the next <code>RegionAttributes</code> created. This value is + * used in initializing the map that holds the entries. Default is 0.75. + * * @param loadFactor the load factor of the entry map * @throws IllegalArgumentException if loadFactor is nonpositive * @see java.util.HashMap */ public void setLoadFactor(float loadFactor) { if (loadFactor <= 0) - throw new IllegalArgumentException(LocalizedStrings.AttributesFactory_LOADFACTOR_MUST_BE_0_VALUE_IS_0.toLocalizedString(new Float(loadFactor))); + throw new IllegalArgumentException( + LocalizedStrings.AttributesFactory_LOADFACTOR_MUST_BE_0_VALUE_IS_0 + .toLocalizedString(new Float(loadFactor))); this.regionAttributes.loadFactor = loadFactor; this.regionAttributes.setHasLoadFactor(true); } - /** Sets the concurrency level of the next <code>RegionAttributes</code> - * created. This value is used in initializing the map that holds the entries. - * Default is 16. + /** + * Sets the concurrency level of the next <code>RegionAttributes</code> created. This value is + * used in initializing the map that holds the entries. Default is 16. + * * @param concurrencyLevel the concurrency level of the entry map * @throws IllegalArgumentException if concurrencyLevel is nonpositive */ public void setConcurrencyLevel(int concurrencyLevel) { if (concurrencyLevel <= 0) - throw new IllegalArgumentException(LocalizedStrings.AttributesFactory_CONCURRENCYLEVEL_MUST_BE_0.toLocalizedString()); + throw new IllegalArgumentException( + LocalizedStrings.AttributesFactory_CONCURRENCYLEVEL_MUST_BE_0.toLocalizedString()); this.regionAttributes.concurrencyLevel = concurrencyLevel; this.regionAttributes.setHasConcurrencyLevel(true); } - + /** - * Enables or disabled concurrent modification checks. Concurrency checks are enabled - * by default. + * Enables or disabled concurrent modification checks. Concurrency checks are enabled by default. + * * @since GemFire 7.0 * @param concurrencyChecksEnabled whether to perform concurrency checks on operations */ @@ -853,8 +814,7 @@ public class AttributesFactory<K,V> { } /** - * Sets whether or not a persistent backup should be made of the - * region. + * Sets whether or not a persistent backup should be made of the region. * * @since GemFire 3.2 * @deprecated as of GemFire 5.0, use {@link DataPolicy#PERSISTENT_REPLICATE} instead @@ -880,18 +840,19 @@ public class AttributesFactory<K,V> { } } } + /** * Sets whether or not acks are sent after an operation is processed. * * @since GemFire 4.1 - * @deprecated This setting no longer has any effect. + * @deprecated This setting no longer has any effect. */ @Deprecated public void setEarlyAck(boolean earlyAck) { this.regionAttributes.earlyAck = earlyAck; this.regionAttributes.setHasEarlyAck(true); } - + /** * Sets whether or not this region should be considered a publisher. * @@ -900,14 +861,13 @@ public class AttributesFactory<K,V> { */ @Deprecated public void setPublisher(boolean v) { -// this.regionAttributes.publisher = v; -// this.regionAttributes.setHasPublisher(true); + // this.regionAttributes.publisher = v; + // this.regionAttributes.setHasPublisher(true); } /** - * Sets whether or not conflation is enabled for sending messages - * to async peers. - * Default value is false. + * Sets whether or not conflation is enabled for sending messages to async peers. Default value is + * false. * * @since GemFire 4.2.3 */ @@ -915,12 +875,11 @@ public class AttributesFactory<K,V> { this.regionAttributes.enableAsyncConflation = enableAsyncConflation; this.regionAttributes.setHasEnableAsyncConflation(true); } - + /** - * Sets whether or not conflation is enabled for sending messages - * from a cache server to its clients. - * Default is false. + * Sets whether or not conflation is enabled for sending messages from a cache server to its + * clients. Default is false. * * @since GemFire 5.0 */ @@ -931,37 +890,41 @@ public class AttributesFactory<K,V> { /** * adds a gateway sender to the end of list of gateway senders on this factory + * * @param gatewaySenderId * @throws IllegalArgumentException if <code>gatewaySender</code> is null * @since GemFire 7.0 */ public void addGatewaySenderId(String gatewaySenderId) { if (gatewaySenderId == null) { - throw new IllegalArgumentException(LocalizedStrings.AttributesFactory_GATEWAY_SENDER_ID_IS_NULL.toLocalizedString()); + throw new IllegalArgumentException( + LocalizedStrings.AttributesFactory_GATEWAY_SENDER_ID_IS_NULL.toLocalizedString()); } synchronized (this.regionAttributes) { this.regionAttributes.addGatewaySenderId(gatewaySenderId); } } - + /** * Adds a AsyncEventQueue to the end of list of async event queues on this factory + * * @param asyncEventQueueId * @throws IllegalArgumentException if <code>gatewaySender</code> is null * @since GemFire 7.0 */ public void addAsyncEventQueueId(String asyncEventQueueId) { if (asyncEventQueueId == null) { - throw new IllegalArgumentException(LocalizedStrings.AttributesFactory_GATEWAY_SENDER_ID_IS_NULL.toLocalizedString()); + throw new IllegalArgumentException( + LocalizedStrings.AttributesFactory_GATEWAY_SENDER_ID_IS_NULL.toLocalizedString()); } synchronized (this.regionAttributes) { this.regionAttributes.addAsyncEventQueueId(asyncEventQueueId); } } - + /** - * Sets whether or not conflation is enabled for sending messages - * from a cache server to its clients. + * Sets whether or not conflation is enabled for sending messages from a cache server to its + * clients. * * @since GemFire 5.0 * @deprecated as of 5.7 use {@link #setEnableSubscriptionConflation} instead. @@ -972,11 +935,11 @@ public class AttributesFactory<K,V> { } /** - * Sets whether or not conflation is enabled for sending messages - * from a cache server to its clients. + * Sets whether or not conflation is enabled for sending messages from a cache server to its + * clients. * * @deprecated as of GemFire 5.0, use {@link #setEnableSubscriptionConflation} - */ + */ @Deprecated public void setEnableConflation(boolean enableBridgeConflation) { setEnableSubscriptionConflation(enableBridgeConflation); @@ -993,8 +956,9 @@ public class AttributesFactory<K,V> { @Deprecated public void setDiskWriteAttributes(DiskWriteAttributes attrs) { if (this.regionAttributes.getDiskStoreName() != null) { - throw new IllegalStateException(LocalizedStrings.DiskStore_Deprecated_API_0_Cannot_Mix_With_DiskStore_1 - .toLocalizedString(new Object[] {"setDiskWriteAttributes", this.regionAttributes.getDiskStoreName()})); + throw new IllegalStateException( + LocalizedStrings.DiskStore_Deprecated_API_0_Cannot_Mix_With_DiskStore_1.toLocalizedString( + new Object[] {"setDiskWriteAttributes", this.regionAttributes.getDiskStoreName()})); } this.regionAttributes.diskWriteAttributes = attrs; this.regionAttributes.setHasDiskWriteAttributes(true); @@ -1005,8 +969,7 @@ public class AttributesFactory<K,V> { } /** - * Sets the directories with - * the default size of 10240 MB to which the region's data is written + * Sets the directories with the default size of 10240 MB to which the region's data is written * * @throws GemFireIOException if a directory does not exist * @@ -1016,13 +979,14 @@ public class AttributesFactory<K,V> { @Deprecated public void setDiskDirs(File[] diskDirs) { if (this.regionAttributes.getDiskStoreName() != null) { - throw new IllegalStateException(LocalizedStrings.DiskStore_Deprecated_API_0_Cannot_Mix_With_DiskStore_1 - .toLocalizedString(new Object[] {"setDiskDirs", this.regionAttributes.getDiskStoreName()})); + throw new IllegalStateException( + LocalizedStrings.DiskStore_Deprecated_API_0_Cannot_Mix_With_DiskStore_1.toLocalizedString( + new Object[] {"setDiskDirs", this.regionAttributes.getDiskStoreName()})); } DiskStoreFactoryImpl.checkIfDirectoriesExist(diskDirs); this.regionAttributes.diskDirs = diskDirs; this.regionAttributes.diskSizes = new int[diskDirs.length]; - for (int i=0; i < diskDirs.length; i++) { + for (int i = 0; i < diskDirs.length; i++) { this.regionAttributes.diskSizes[i] = DiskStoreFactory.DEFAULT_DISK_DIR_SIZE; } if (!this.regionAttributes.hasDiskWriteAttributes() @@ -1035,65 +999,72 @@ public class AttributesFactory<K,V> { } /** - * Sets the DiskStore name attribute. - * This causes the region to use the {@link DiskStore}. + * Sets the DiskStore name attribute. This causes the region to use the {@link DiskStore}. + * * @param name the name of the diskstore * @since GemFire 6.5 */ public void setDiskStoreName(String name) { - if (this.regionAttributes.hasDiskDirs() || this.regionAttributes.hasDiskWriteAttributes()) { - throw new IllegalStateException(LocalizedStrings.DiskStore_Deprecated_API_0_Cannot_Mix_With_DiskStore_1 - .toLocalizedString(new Object[] {"setDiskDirs or setDiskWriteAttributes", name})); + if (this.regionAttributes.hasDiskDirs() || this.regionAttributes.hasDiskWriteAttributes()) { + throw new IllegalStateException( + LocalizedStrings.DiskStore_Deprecated_API_0_Cannot_Mix_With_DiskStore_1 + .toLocalizedString(new Object[] {"setDiskDirs or setDiskWriteAttributes", name})); } this.regionAttributes.diskStoreName = name; this.regionAttributes.setHasDiskStoreName(true); } - + /** - * Sets whether or not the writing to the disk is synchronous. - * Default is true. + * Sets whether or not the writing to the disk is synchronous. Default is true. * - * @param isSynchronous - * boolean if true indicates synchronous writes + * @param isSynchronous boolean if true indicates synchronous writes * @since GemFire 6.5 */ @SuppressWarnings("deprecation") - public void setDiskSynchronous(boolean isSynchronous) - { + public void setDiskSynchronous(boolean isSynchronous) { this.regionAttributes.diskSynchronous = isSynchronous; this.regionAttributes.setHasDiskSynchronous(true); if (this.regionAttributes.hasDiskWriteAttributes()) { - DiskWriteAttributesFactory dwaf = new DiskWriteAttributesFactory(this.regionAttributes.diskWriteAttributes); + DiskWriteAttributesFactory dwaf = + new DiskWriteAttributesFactory(this.regionAttributes.diskWriteAttributes); dwaf.setSynchronous(isSynchronous); this.regionAttributes.diskWriteAttributes = dwaf.create(); } else { if (isSynchronous) { - this.regionAttributes.diskWriteAttributes = DiskWriteAttributesImpl.getDefaultSyncInstance(); + this.regionAttributes.diskWriteAttributes = + DiskWriteAttributesImpl.getDefaultSyncInstance(); } else { - this.regionAttributes.diskWriteAttributes = DiskWriteAttributesImpl.getDefaultAsyncInstance(); + this.regionAttributes.diskWriteAttributes = + DiskWriteAttributesImpl.getDefaultAsyncInstance(); } } } /** - * Sets the directories to which the region's data is written and also set their sizes in megabytes + * Sets the directories to which the region's data is written and also set their sizes in + * megabytes * - * @throws IllegalArgumentException if a dir does not exist or the length of the size array - * does not match to the length of the dir array or the given length is not a valid positive number + * @throws IllegalArgumentException if a dir does not exist or the length of the size array does + * not match to the length of the dir array or the given length is not a valid positive + * number * * @since GemFire 5.1 * @deprecated as of 6.5 use {@link DiskStoreFactory#setDiskDirsAndSizes} instead */ @Deprecated - public void setDiskDirsAndSizes(File[] diskDirs,int[] diskSizes) { + public void setDiskDirsAndSizes(File[] diskDirs, int[] diskSizes) { if (this.regionAttributes.getDiskStoreName() != null) { - throw new IllegalStateException(LocalizedStrings.DiskStore_Deprecated_API_0_Cannot_Mix_With_DiskStore_1 - .toLocalizedString(new Object[] {"setDiskDirsAndSizes", this.regionAttributes.getDiskStoreName()})); + throw new IllegalStateException( + LocalizedStrings.DiskStore_Deprecated_API_0_Cannot_Mix_With_DiskStore_1.toLocalizedString( + new Object[] {"setDiskDirsAndSizes", this.regionAttributes.getDiskStoreName()})); } DiskStoreFactoryImpl.checkIfDirectoriesExist(diskDirs); this.regionAttributes.diskDirs = diskDirs; - if(diskSizes.length != this.regionAttributes.diskDirs.length) { - throw new IllegalArgumentException(LocalizedStrings.AttributesFactory_NUMBER_OF_DISKSIZES_IS_0_WHICH_IS_NOT_EQUAL_TO_NUMBER_OF_DISK_DIRS_WHICH_IS_1.toLocalizedString(new Object[] {Integer.valueOf(diskSizes.length), Integer.valueOf(diskDirs.length)})); + if (diskSizes.length != this.regionAttributes.diskDirs.length) { + throw new IllegalArgumentException( + LocalizedStrings.AttributesFactory_NUMBER_OF_DISKSIZES_IS_0_WHICH_IS_NOT_EQUAL_TO_NUMBER_OF_DISK_DIRS_WHICH_IS_1 + .toLocalizedString(new Object[] {Integer.valueOf(diskSizes.length), + Integer.valueOf(diskDirs.length)})); } DiskStoreFactoryImpl.verifyNonNegativeDirSize(diskSizes); this.regionAttributes.diskSizes = diskSizes; @@ -1107,37 +1078,39 @@ public class AttributesFactory<K,V> { } /** - * Sets the <code>PartitionAttributes</code> that describe how the - * region is partitioned among members of the distributed system. This - * also establishes a data policy of {@link DataPolicy#PARTITION PARTITION}, - * if the data policy has not already been set. + * Sets the <code>PartitionAttributes</code> that describe how the region is partitioned among + * members of the distributed system. This also establishes a data policy of + * {@link DataPolicy#PARTITION PARTITION}, if the data policy has not already been set. * * @since GemFire 5.0 */ public void setPartitionAttributes(PartitionAttributes partition) { if (partition != null) { - if (! this.regionAttributes.hasDataPolicy()) { - this.regionAttributes.dataPolicy = PartitionedRegionHelper.DEFAULT_DATA_POLICY; - } - else if ( !PartitionedRegionHelper.ALLOWED_DATA_POLICIES.contains(this.regionAttributes.dataPolicy) ) { - throw new IllegalStateException(LocalizedStrings.AttributesFactory_DATA_POLICY_0_IS_NOT_ALLOWED_FOR_A_PARTITIONED_REGION_DATAPOLICIES_OTHER_THAN_1_ARE_NOT_ALLOWED - .toLocalizedString(new Object[] {this.regionAttributes.dataPolicy, PartitionedRegionHelper.ALLOWED_DATA_POLICIES})); + if (!this.regionAttributes.hasDataPolicy()) { + this.regionAttributes.dataPolicy = PartitionedRegionHelper.DEFAULT_DATA_POLICY; + } else if (!PartitionedRegionHelper.ALLOWED_DATA_POLICIES + .contains(this.regionAttributes.dataPolicy)) { + throw new IllegalStateException( + LocalizedStrings.AttributesFactory_DATA_POLICY_0_IS_NOT_ALLOWED_FOR_A_PARTITIONED_REGION_DATAPOLICIES_OTHER_THAN_1_ARE_NOT_ALLOWED + .toLocalizedString(new Object[] {this.regionAttributes.dataPolicy, + PartitionedRegionHelper.ALLOWED_DATA_POLICIES})); } - if (this.regionAttributes.hasPartitionAttributes() + if (this.regionAttributes.hasPartitionAttributes() && this.regionAttributes.partitionAttributes instanceof PartitionAttributesImpl && partition instanceof PartitionAttributesImpl) { // Make a copy and call merge on it to prevent bug 51616 - PartitionAttributesImpl copy = ((PartitionAttributesImpl) this.regionAttributes.partitionAttributes).copy(); + PartitionAttributesImpl copy = + ((PartitionAttributesImpl) this.regionAttributes.partitionAttributes).copy(); copy.merge((PartitionAttributesImpl) partition); this.regionAttributes.partitionAttributes = copy; } else { this.regionAttributes.partitionAttributes = partition; this.regionAttributes.setHasPartitionAttributes(true); } - - ((PartitionAttributesImpl) this.regionAttributes.partitionAttributes).setOffHeap(this.regionAttributes.offHeap); - } - else { + + ((PartitionAttributesImpl) this.regionAttributes.partitionAttributes) + .setOffHeap(this.regionAttributes.offHeap); + } else { this.regionAttributes.partitionAttributes = null; this.regionAttributes.setHasPartitionAttributes(false); } @@ -1145,11 +1118,11 @@ public class AttributesFactory<K,V> { protected void setBucketRegion(boolean b) { this.regionAttributes.isBucketRegion = b; - } - + } + /** - * Sets the <code>MembershipAttributes</code> that describe the membership - * roles required for reliable access to the region. + * Sets the <code>MembershipAttributes</code> that describe the membership roles required for + * reliable access to the region. * * @deprecated this API is scheduled to be removed */ @@ -1159,8 +1132,8 @@ public class AttributesFactory<K,V> { } /** - * Sets the <code>SubscriptionAttributes</code> that describe how the region - * will subscribe to other distributed cache instances of the region. + * Sets the <code>SubscriptionAttributes</code> that describe how the region will subscribe to + * other distributed cache instances of the region. * * @since GemFire 5.0 */ @@ -1170,9 +1143,8 @@ public class AttributesFactory<K,V> { } /** - * Set how indexes on the region should be maintained. It will be either synchronous - * or asynchronous. - * Default is true. + * Set how indexes on the region should be maintained. It will be either synchronous or + * asynchronous. Default is true. */ public void setIndexMaintenanceSynchronous(boolean synchronous) { this.regionAttributes.indexMaintenanceSynchronous = synchronous; @@ -1180,8 +1152,9 @@ public class AttributesFactory<K,V> { } // STATISTICS - /** Sets whether statistics are enabled for this region and its entries. - * Default is false. + /** + * Sets whether statistics are enabled for this region and its entries. Default is false. + * * @param statisticsEnabled whether statistics are enabled */ public void setStatisticsEnabled(boolean statisticsEnabled) { @@ -1190,8 +1163,8 @@ public class AttributesFactory<K,V> { } /** - * Sets the flag telling a region to ignore JTA transactions. - * Default is false. + * Sets the flag telling a region to ignore JTA transactions. Default is false. + * * @since GemFire 5.0 */ public void setIgnoreJTA(boolean flag) { @@ -1199,8 +1172,9 @@ public class AttributesFactory<K,V> { this.regionAttributes.setHasIgnoreJTA(true); } - /** Sets whether this region should become lock grantor. - * Default value is false. + /** + * Sets whether this region should become lock grantor. Default value is false. + * * @param isLockGrantor whether this region should become lock grantor */ public void setLockGrantor(boolean isLockGrantor) { @@ -1208,22 +1182,22 @@ public class AttributesFactory<K,V> { this.regionAttributes.setHasIsLockGrantor(true); } - /** Sets whether distributed operations on this region should attempt - to use multicast. Multicast must also be enabled in the - cache's DistributedSystem (see - <a href=../distributed/DistributedSystem.html#mcast-port">"mcast-port"</a>). - Default is false. - @since GemFire 5.0 - @see RegionAttributes#getMulticastEnabled + /** + * Sets whether distributed operations on this region should attempt to use multicast. Multicast + * must also be enabled in the cache's DistributedSystem (see <a + * href=../distributed/DistributedSystem.html#mcast-port">"mcast-port"</a>). Default is false. + * + * @since GemFire 5.0 + * @see RegionAttributes#getMulticastEnabled */ public void setMulticastEnabled(boolean value) { this.regionAttributes.multicastEnabled = value; this.regionAttributes.setHasMulticastEnabled(true); - } + } + /** - * Sets cloning on region. - * Default is false. - * Note: off-heap regions always behave as if cloning is enabled. + * Sets cloning on region. Default is false. Note: off-heap regions always behave as if cloning is + * enabled. * * @param cloningEnable * @since GemFire 6.1 @@ -1234,21 +1208,20 @@ public class AttributesFactory<K,V> { this.regionAttributes.setHasCloningEnabled(true); } - + /** - * Sets the pool name attribute. - * This causes regions that use these attributes - * to be a client region which communicates with the - * servers that the connection pool communicates with. - * <p>If this attribute is set to <code>null</code> or <code>""</code> - * then the connection pool is disabled causing regions that use these attributes - * to be communicate with peers instead of servers. - * <p>The named connection pool must exist on the cache at the time these - * attributes are used to create a region. See {@link PoolManager#createFactory} - * for how to create a connection pool. - * @param name the name of the connection pool to use; if <code>null</code> - * or <code>""</code> then the connection pool is disabled for regions - * using these attributes. + * Sets the pool name attribute. This causes regions that use these attributes to be a client + * region which communicates with the servers that the connection pool communicates with. + * <p> + * If this attribute is set to <code>null</code> or <code>""</code> then the connection pool is + * disabled causing regions that use these attributes to be communicate with peers instead of + * servers. + * <p> + * The named connection pool must exist on the cache at the time these attributes are used to + * create a region. See {@link PoolManager#createFactory} for how to create a connection pool. + * + * @param name the name of the connection pool to use; if <code>null</code> or <code>""</code> + * then the connection pool is disabled for regions using these attributes. * @since GemFire 5.7 */ public void setPoolName(String name) { @@ -1258,18 +1231,19 @@ public class AttributesFactory<K,V> { } this.regionAttributes.poolName = nm; this.regionAttributes.setHasPoolName(true); - + } - + /** * Sets this region's compressor for compressing entry values. + * * @since GemFire 8.0 * @param compressor a compressor. */ public void setCompressor(Compressor compressor) { this.regionAttributes.compressor = compressor; this.regionAttributes.setHasCompressor(true); - + // Cloning must be enabled when a compressor is set if (compressor != null) { setCloningEnabled(true); @@ -1278,56 +1252,62 @@ public class AttributesFactory<K,V> { /** * Enables this region's usage of off-heap memory if true. + * * @since Geode 1.0 * @param offHeap boolean flag to enable off-heap memory */ public void setOffHeap(boolean offHeap) { this.regionAttributes.offHeap = offHeap; this.regionAttributes.setHasOffHeap(true); - + if (this.regionAttributes.partitionAttributes != null) { ((PartitionAttributesImpl) this.regionAttributes.partitionAttributes).setOffHeap(offHeap); } } - + // FACTORY METHOD - /** Creates a <code>RegionAttributes</code> with the current settings. + /** + * Creates a <code>RegionAttributes</code> with the current settings. + * * @return the newly created <code>RegionAttributes</code> * @throws IllegalStateException if the current settings violate the - * <a href="#compatibility">compatibility rules</a> + * <a href="#compatibility">compatibility rules</a> * @deprecated as of GemFire 5.0, use {@link #create} instead */ @Deprecated - public RegionAttributes<K,V> createRegionAttributes() { + public RegionAttributes<K, V> createRegionAttributes() { return create(); } - /** Creates a <code>RegionAttributes</code> with the current settings. + + /** + * Creates a <code>RegionAttributes</code> with the current settings. + * * @return the newly created <code>RegionAttributes</code> * @throws IllegalStateException if the current settings violate the - * <a href="#compatibility">compatibility rules</a> + * <a href="#compatibility">compatibility rules</a> * @since GemFire 5.0 */ @SuppressWarnings("unchecked") - public RegionAttributes<K,V> create() { - if (this.regionAttributes.hasDataPolicy() && - this.regionAttributes.dataPolicy.withPartitioning() && - this.regionAttributes.partitionAttributes == null) { + public RegionAttributes<K, V> create() { + if (this.regionAttributes.hasDataPolicy() && this.regionAttributes.dataPolicy.withPartitioning() + && this.regionAttributes.partitionAttributes == null) { this.regionAttributes.partitionAttributes = (new PartitionAttributesFactory()).create(); - // fix bug #52033 by invoking setOffHeap now (localMaxMemory may now be the temporary placeholder for off-heap until DistributedSystem is created - ((PartitionAttributesImpl)this.regionAttributes.partitionAttributes).setOffHeap(this.regionAttributes.getOffHeap()); + // fix bug #52033 by invoking setOffHeap now (localMaxMemory may now be
<TRUNCATED>
