7.5. Marshaling 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 marshaling framework. In the JBoss Cache 2.x.x series, this is the only officially supported and recommended mechanism for writing objects to datastreams.
The Marshaler interface

Figure 7.3. The Marshaler interface

7.5.1. The Marshaler Interface

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