|
GemFire 5.8 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.gemstone.gemfire.cache.PartitionAttributesFactory
public class PartitionAttributesFactory
A factory that creates instances of PartitionAttributes which are
used to create a partitioned Region. The setter methods follow the
self-return idiom so that they can be "chained" togeather with the
create() method to create
PartitionAttributes. For example:
PartitionAttributes pa = new PartitionAttributesFactory()
.setRedundantCopies(1)
.setLocalMaxMemory(1240)
.create();
final Region myRegion = new RegionFactory()
.setPartitionAttributes(pa)
.setKeyConstraint(String.class)
.setValueConstraint(ArrayList.class)
.create("myRegion");
Partitioned attributes can also be definied in a delarative fashion using a
cache.xml file. Here is an
example of how to configure a Partitioned Region named "pRoot" whose
Scope is Distributed Ack, which maintains
a redundant copy of any given
Region.Entry, configures a
CacheLoader implementation, and sets
global properties as well as
local max memory to use.
<root-region name="pRoot">
<region-attributes scope="distributed-ack" >
<partition-attributes redundant-copies="1", local-max-memory="1240"/>
</region-attributes>
</root-region>
PartitionAttributes,
AttributesFactory.setPartitionAttributes(PartitionAttributes)| Field Summary | |
|---|---|
static int |
GLOBAL_MAX_BUCKETS_DEFAULT
The default total number of buckets (113). |
static String |
GLOBAL_MAX_BUCKETS_PROPERTY
Deprecated - please use setTotalNumBuckets(int) instead. |
static long |
GLOBAL_MAX_MEMORY_DEFAULT
Default maximum total size of the region across all processes, in megabytes. |
static String |
GLOBAL_MAX_MEMORY_PROPERTY
Deprecated - use setTotalMaxMemory(long) instead. |
static int |
LOCAL_MAX_MEMORY_DEFAULT
The default maximum amount of memory to be used by this region in this process, in megabytes. |
static String |
LOCAL_MAX_MEMORY_PROPERTY
Deprecated - please use the setLocalMaxMemory(int) method instead. |
| Constructor Summary | |
|---|---|
PartitionAttributesFactory()
Creates a new instance of PartitionAttributesFactory ready to create a PartitionAttributes with default settings. |
|
PartitionAttributesFactory(PartitionAttributes pa)
Creates a new instance of PartitionAttributesFactory ready to create a PartitionAttributes with the same settings as those in
the specified PartitionAttributes |
|
| Method Summary | |
|---|---|
PartitionAttributes |
create()
Creates a PartitionAttributes with the current settings. |
PartitionAttributesFactory |
setCacheLoader(CacheLoader cacheLoader)
Deprecated. AttributesFactory.setCacheLoader(com.gemstone.gemfire.cache.CacheLoader) allows you to establish
a cache loader for a partitioned region |
PartitionAttributesFactory |
setColocatedWith(String colocatedRegionFullPath)
Sets the name of the PartitionRegion with which this newly created partitioned region is colocated |
PartitionAttributesFactory |
setGlobalProperties(Properties globalProps)
Deprecated. use setTotalMaxMemory(long) and setTotalNumBuckets(int) in GemFire 5.1 and later releases |
PartitionAttributesFactory |
setLocalMaxMemory(int mb)
Sets the maximum amount of memory, in megabytes, to be used by the region in this process. |
PartitionAttributesFactory |
setLocalProperties(Properties localProps)
Deprecated. use setLocalMaxMemory(int) in GemFire 5.1 and later releases |
PartitionAttributesFactory |
setPartitionResolver(PartitionResolver resolver)
Sets the PartitionResolver for the PartitionRegion. |
PartitionAttributesFactory |
setRedundantCopies(int redundantCopies)
Sets the number of extra copies of buckets desired. |
PartitionAttributesFactory |
setTotalMaxMemory(long mb)
Sets the maximum amount of memory, in megabytes, to be used by the region in all processes. |
PartitionAttributesFactory |
setTotalNumBuckets(int numBuckets)
Sets the total number of hash buckets to be used by the region in all processes. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String LOCAL_MAX_MEMORY_PROPERTY
setLocalMaxMemory(int) method instead.
The local property name that sets
the maximum heap storage a VM contributes to a partitioned Region. When set
to zero, the resulting Region reference allows access to the partitioned
Region without any consuming any heap storage.
public static final int LOCAL_MAX_MEMORY_DEFAULT
public static final String GLOBAL_MAX_MEMORY_PROPERTY
setTotalMaxMemory(long) instead.
The global property name that
defines the total maximum size for the partitioned Region.
This setting must be the same in all processes using the Region.
public static final long GLOBAL_MAX_MEMORY_DEFAULT
public static final String GLOBAL_MAX_BUCKETS_PROPERTY
setTotalNumBuckets(int) instead.This setting must be the same in all processes using the Region.
public static final int GLOBAL_MAX_BUCKETS_DEFAULT
| Constructor Detail |
|---|
public PartitionAttributesFactory()
PartitionAttributes with default settings.
public PartitionAttributesFactory(PartitionAttributes pa)
PartitionAttributes with the same settings as those in
the specified PartitionAttributes
pa - the PartitionAttributes used to initialize this
PartitionAttributesFactory| Method Detail |
|---|
public PartitionAttributesFactory setRedundantCopies(int redundantCopies)
This setting must be the same in all processes using the Region.
redundantCopies - the number of redundant bucket copies, limited to values 0, 1, 2 and 3.
public PartitionAttributesFactory setCacheLoader(CacheLoader cacheLoader)
AttributesFactory.setCacheLoader(com.gemstone.gemfire.cache.CacheLoader) allows you to establish
a cache loader for a partitioned region
PartitionAttributes
created.
cacheLoader - the cache writer or null if no cache writer
public PartitionAttributesFactory setLocalMaxMemory(int mb)
public PartitionAttributesFactory setTotalMaxMemory(long mb)
This setting must be the same in all processes using the Region.
public PartitionAttributesFactory setTotalNumBuckets(int numBuckets)
This setting must be the same in all processes using the Region.
A bucket is the smallest unit of data management in a partitioned region.
Entries are stored in
buckets and buckets may move from one VM to another. Buckets may also have
copies, depending on redundancy to provide
high availability in the face of VM failure.
The number of buckets should be prime and as a rough guide at the least four
times the number of partition VMs. However, there is significant overhead
to managing a bucket, particularly for higher values of
redundancy.
public PartitionAttributesFactory setPartitionResolver(PartitionResolver resolver)
PartitionResolver for the PartitionRegion.
public PartitionAttributesFactory setColocatedWith(String colocatedRegionFullPath)
public PartitionAttributesFactory setLocalProperties(Properties localProps)
setLocalMaxMemory(int) in GemFire 5.1 and later releases
Properties for the local instance the partitioned
Region. Local properties define how the local instance of the partitioned
region and any storage it may provide, behaves. There are currently no
non-deprecated local properties.
localProps -
public PartitionAttributesFactory setGlobalProperties(Properties globalProps)
setTotalMaxMemory(long) and setTotalNumBuckets(int) in GemFire 5.1 and later releases
Properties for the next PartitionAttributes
created. Global properties define how the entire partitioned Region behaves.
Note that global settings must be the same in all processes using the Region.
globalProps -
GLOBAL_MAX_MEMORY_PROPERTYpublic PartitionAttributes create()
PartitionAttributes with the current settings.
PartitionAttributes
IllegalStateException - if the current settings violate the compatibility rules
|
GemFire 5.8 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||