Este contenido no está disponible en el idioma seleccionado.
Chapter 43. Configuring Compatibility Mode
Compatibility mode provides a mechanism for accessing data in the cache from multiple endpoints.
Compatibility mode configures JBoss Data Grid to use a marshaller that serializes and deserializes raw bytes into strings and primitives. For this reason, compatibility mode supports only strings and primitives and does not support objects.
Compatibility mode is not an efficient method for achieving interoperability between remote endpoints. It is a legacy feature that is not recommended for new deployments.
Instead of using compatibility mode, you should configure the format in which the cache stores data by defined the media type. See Endpoint Interoperability.
43.1. Enabling Compatibility Mode
To enable compatibility mode, add enabled=true
to the compatibility
element as follows:
<cache-container name="local" default-cache="default" statistics="true"> <local-cache name="default" statistics="true"> <compatibility enabled="true"/> </local-cache> </cache-container>
43.2. Marshallers in Compatibility Mode
JBoss Data Grid does not support custom marshallers. You can use the following marshallers in compatibility mode:
Marshaller | Description |
---|---|
| Uses the JBoss marshaller to serialize and deserialize strings and primitives as byte arrays. This is the default marshaller in compatibility mode. |
| Uses the ProtoStream library to serialize and deserialize strings and primitives as byte arrays. |
| Serializes and deserializes strings and primitives as UTF8 byte arrays. |
43.3. Specifying the Marshaller
Specify marshallers with the marshaller
attribute, as in the following example:
<cache-container name="local" default-cache="default" statistics="true"> <local-cache name="default" statistics="true"> <compatibility enabled="true" marshaller="org.infinispan.commons.marshall.UTF8StringMarshaller"/> </local-cache> </cache-container>
43.3.1. Memcached Marshaller
When using memcached in compatibility mode, you must explicitly set the default marshaller, GenericJBossMarshaller
, in the configuration. For example:
<cache-container name="local" default-cache="default" statistics="true"> <local-cache name="default" statistics="true"> <compatibility enabled="true" marshaller="org.infinispan.commons.marshall.jboss.GenericJBossMarshaller"/> </local-cache> </cache-container>
Java clients must use a transcoder to perform read and write operations in compatibility mode. The transcoder enables memcached clients written in Java to convert between byte arrays and strings or primitives.