Follow these guidelines to use custom domain classes for your cached entry keys and values in Tanzu GemFire_long.
Each member’s CLASSPATH
must include classes for all objects the member accesses.
CLASSPATH
.CLASSPATH
environment variable or the gfsh start server
’s --classpath
parameter. See Running Tanzu GemFire Server 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 CLASSPATH
must include the classes for:
PdxInstance
or transfer of the full entry value to a clientFor information on PdxInstance
s, see Data Serialization.
Tanzu GemFire serializes data entry keys and values for distribution, so all data that Tanzu 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 on 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.