[Java programming language only]

Serializer programming overview

You can use the DataSerializer plug-ins to write optimized serializers for storing Java™ objects and other data in binary form in the grid. The plug-in also provides methods that you can use to query attributes within the binary data without requiring the entire data object to be inflated.

The DataSerializer plug-ins include three main plug-ins and several optional mix-in interfaces. The MapSerializerPlugin plug-in includes metadata about the relationship between a map and other maps. It also includes a reference to a KeySerializerPlugin and ValueSerializerPlugin. The key and value serializer plug-ins include metadata and serialization code responsible for interacting with the respective key and value data for a map. A MapSerializerPlugin plug-in must include one or both key and value serializers.

The KeySerializerPlugin plug-in provides methods and metadata for serializing, inflating and introspecting keys. The ValueSerializer plug-in provides methods and metadata for serializing, inflating and introspecting values. Both interfaces have different requirements. For details on what methods are available on the DataSerializer plug-ins, see the API documentation for the com.ibm.websphere.objectgrid.plugins.io package.

MapSerializerPlugin plug-in
The MapSerializerPlugin is the main plug-in point to the BackingMap interface, and it includes two nested plug-ins: the KeySerializerPlugin and ValueSerializerPlugin plug-ins. Since eXtreme Scale does not support nested or wired plug-ins, the BasicMapSerializerPlugin plug-in accesses these nested plug-ins artificially. When you use these plug-ins with the OSGi framework, the only proxy is the MapSerializerPlugin plug-in. All nested plug-ins must not be cached within other dependent plug-ins, such as loaders, unless those plug-ins also listen for BackingMap life cycle events. This is important when running in an OSGi framework, because references to those plug-ins can continue to be refreshed.
KeySerializerPlugin plug-in
The KeySerializerPlugin plug-in extends the DataSerializer interface and includes other mix-in interfaces and metadata that describes the key. Use this plug-in to serialize and inflate key data objects and attributes.
ValueSerializerPlugin plug-in
The ValueSerializerPlugin plug-in extends the DataSerializer interface, but exposes no additional methods. Use this plug-in to serialize and inflate value data objects and attributes.

Optional and mix-in interfaces

Optional and mix-in interfaces provide additional capabilities, such as:
Optimistic versioning
The Versionable interface allows the ValueSerializerPlugin plug-in to handle version checking and version updates when using optimistic locking. If the Versioning is not implemented and optimistic locking is enabled, then the version is the entire serialized form of the data object value.
Non-hashCode-based routing
The Partitionable interface allows KeySerializerPlugin implementations to route requests to explicit partitions. This is equivalent to the PartitionableKey interface, when used with the ObjectMap API without a KeySerializerPlugin. Without this feature, the key is routed to the partition based on the resulting hashCode.
UserReadable (toString) interface
The UserReadable (toString) interface allows all DataSerializer implementations to provide an alternative method to display data in log files and debuggers. With this capability, you can hide sensitive data such as passwords. If DataSerializer implementations do not implement this interface, then the runtime environment might call toString() directly on the object or include alternative representations, if appropriate.
Evolution support
The Mergeable interface can be implemented on ValueSerializerPlugin plug-in implementations to allow interoperability between multiple versions of objects when there are different DataSerializer versions updating data in the grid through it's lifetime. The Mergeable methods allow the DataSerializer plug-in to retain any data that it might not otherwise understand.