Follow these guidelines to use custom domain classes for your cached entry keys and values in VMware Tanzu GemFire.
Each member’s classloader must include classes for all objects the member accesses.
start
command’s --classpath
parameter. See Running GemFire Server Processes or Running GemFire Locator Processes.Data is sent between clients and servers in serialized form and the server stores client data in serialized form. The server does not need to deserialize data to send it to another client or to access it through a PDXInstance
, but it does need to deserialize it to access it in other ways. The server’s classloader must include the classes for:
PdxInstance
or transfer of the full entry value to a clientGemFire serializes data entry keys and values for distribution, so all data that GemFire moves out of the local cache for any reason must be serializable. Additionally, partitioned regions store data in serialized form. Almost every configuration requires serialization.
For information about the requirements and options for data serialization, see Data Serialization.
The region uses hashing on keys. If you define a custom class to use as a key, for the class, override:
equals
hashCode
. The default hashCode
inherited from Object
uses identity, which is different in every system member. In partitioned regions, hashing based on identity puts data in the wrong place. For details, see the Java API documentation for java.lang.Object
.Do not call hashCode()
on an enum
type data member within the key’s custom hashCode()
implementation. The enum
hashCode()
may not be overridden, and its hash is based upon an address. Therefore, an enumerated type’s hashCode()
return value can be different on each server, violating the restriction that hashCode()
must return the same value on every server that hosts the region.