Este conteúdo não está disponível no idioma selecionado.
13.9. Hot Rod Java Client
13.9.1. Hot Rod Java Client Download Copiar o linkLink copiado para a área de transferência!
Procedure 13.2. Download Hot Rod Java Client
- Log into the Customer Portal at https://access.redhat.com.
- Click the button near the top of the page.
- In the Product Downloads page, click .
- Select the appropriate JBoss Data Grid version from the Version: drop down menu.
- Locate the Red Hat JBoss Data Grid ${VERSION} Hot Rod Java Client entry and click the corresponding link.
13.9.2. Hot Rod Java Client Configuration Copiar o linkLink copiado para a área de transferência!
Example 13.1. Client Instance Creation
To configure the Hot Rod Java client, edit the hotrod-client.properties file on the classpath.
hotrod-client.properties file.
Example 13.2. Configuration
Note
TCP KEEPALIVE configuration is enabled/disabled on the Hot Rod Java client either through a config property as seen in the example (infinispan.client.hotrod.tcp_keep_alive = true/false or programmatically through the org.infinispan.client.hotrod.ConfigurationBuilder.tcpKeepAlive() method.
new RemoteCacheManager(boolean start)new RemoteCacheManager()
13.9.3. Hot Rod Java Client Basic API Copiar o linkLink copiado para a área de transferência!
localhost:11222.
Example 13.3. Basic API
RemoteCacheManager corresponds to DefaultCacheManager, and both implement BasicCacheContainer.
DefaultCacheManager and RemoteCacheManager, which is simplified by the common BasicCacheContainer interface.
keySet() method. If the remote cache is a distributed cache, the server will start a Map/Reduce job to retrieve all keys from clustered nodes and return all keys to the client.
Set keys = remoteCache.keySet();
Set keys = remoteCache.keySet();
13.9.4. Hot Rod Java Client Versioned API Copiar o linkLink copiado para a área de transferência!
getVersioned, clients can retrieve the value associated with the key as well as the current version.
RemoteCacheManager provides instances of the RemoteCache interface that accesses the named or default cache on the remote cluster. This extends the Cache interface to which it adds new methods, including the versioned API.
Example 13.4. Using Versioned Methods
Example 13.5. Using Replace
remoteCache.put("car", "ferrari");
VersionedValue valueBinary = remoteCache.getVersioned("car");
assert remoteCache.replaceWithVersion("car", "lamborghini", valueBinary.getVersion());
remoteCache.put("car", "ferrari");
VersionedValue valueBinary = remoteCache.getVersioned("car");
assert remoteCache.replaceWithVersion("car", "lamborghini", valueBinary.getVersion());