6.5. Marshalling And Wire Formats

Early versions of JBoss Cache simply wrote cached data to the network by writing to an ObjectOutputStream during replication. Over various releases in the JBoss Cache 1.x.x series this approach was gradually deprecated in favor of a more mature marshalling framework. In the JBoss Cache 2.x.x series, this is the only officially supported and recommended mechanism for writing objects to datastreams.
The Marshaller interface

Figure 6.3. The Marshaller interface


6.5.1. The Marshaller Interface

The Marshaller interface extends RpcDispatcher.Marshaller from JGroups. This interface has two main implementations - a delegating VersionAwareMarshaller and a concrete CacheMarshaller300 .
The marshaller can be obtained by calling CacheSPI.getMarshaller(), and defaults to the VersionAwareMarshaller. Users may also write their own marshallers by implementing the Marshaller interface or extending the AbstractMarshaller class, and adding it to their configuration by using the Configuration.setMarshallerClass() setter.