Questo contenuto non è disponibile nella lingua selezionata.
23.4. Configuring the Marshaller using the RemoteCacheManager
A Marshaller is specified using the
marshaller
configuration element in the RemoteCacheManager, the value of which must be the name of the class implementing the Marshaller interface. The default value for this property is org.infinispan.commons.marshall.jboss.GenericJBossMarshaller
.
The following procedure describes how to define a Marshaller to use with RemoteCacheManager.
Procedure 23.1. Define a Marshaller
Create a ConfigurationBuilder
Create a ConfigurationBuilder and configure it with the required settings.ConfigurationBuilder builder = new ConfigurationBuilder(); //... (other configuration)
ConfigurationBuilder builder = new ConfigurationBuilder(); //... (other configuration)
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Add a Marshaller Class
Add a Marshaller class specification within the Marshaller method.builder.marshaller(GenericJBossMarshaller.class);
builder.marshaller(GenericJBossMarshaller.class);
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Alternatively, specify a custom Marshaller instance.
builder.marshaller(new GenericJBossMarshaller());
builder.marshaller(new GenericJBossMarshaller());
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Start the RemoteCacheManager
Build the configuration containing the Marshaller, and start a new RemoteCacheManager with it.Configuration configuration = builder.build(); RemoteCacheManager manager = new RemoteCacheManager(configuration);
Configuration configuration = builder.build(); RemoteCacheManager manager = new RemoteCacheManager(configuration);
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
At the client level, POJOs need to be either Serializable, Externalizable, or primitive types.
Note
The Hot Rod Java client does not support providing Externalizer instances to serialize POJOs. This is only available for JBoss Data Grid Library mode.