Skip to content

Commit 37ce718

Browse files
authored
IGNITE-29010 Document Java thin client cache partitions (#13516)
codex co authored by dpavlov
1 parent 464e82f commit 37ce718

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

docs/_docs/code-snippets/java/src/main/java/org/apache/ignite/snippets/JavaThinClient.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
import org.apache.ignite.cache.query.ScanQuery;
4444
import org.apache.ignite.cache.query.SqlFieldsQuery;
4545
import org.apache.ignite.client.ClientAddressFinder;
46+
import org.apache.ignite.client.ClientAffinityConfiguration;
4647
import org.apache.ignite.client.ClientAuthenticationException;
4748
import org.apache.ignite.client.ClientCache;
4849
import org.apache.ignite.client.ClientCacheConfiguration;
@@ -166,6 +167,7 @@ ClientCache<Integer, String> createCache(IgniteClient client) {
166167
// tag::getOrCreateCache[]
167168
ClientCacheConfiguration cacheCfg = new ClientCacheConfiguration().setName("References")
168169
.setCacheMode(CacheMode.REPLICATED)
170+
.setAffinityConfiguration(new ClientAffinityConfiguration().setPartitions(64))
169171
.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
170172

171173
ClientCache<Integer, String> cache = client.getOrCreateCache(cacheCfg);

docs/_docs/thin-clients/java-thin-client.adoc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,8 @@ The `ClientCache` interface provides the key-value API. You can use the followin
170170

171171
Use `IgniteClient.cacheNames()` to list all existing caches.
172172

173+
When creating a cache with `ClientCacheConfiguration`, use `ClientAffinityConfiguration` to configure the default rendezvous affinity settings, such as the number of cache partitions.
174+
173175
[source, java]
174176
-------------------------------------------------------------------------------
175177
include::{sourceCodeFile}[tag=getOrCreateCache,indent=0]
@@ -211,7 +213,7 @@ The query condition is specified by an `IgniteBiPredicate<K, V>` object that is
211213

212214
NOTE: The classes of the predicates must be available on the server nodes of the cluster.
213215

214-
The results of the query are transferred to the client page by page. Each page contains a specific number of entries and is fetched to the client only when the entries from that page are requested. To change the number of entries in a page, use the `ScanQuery.setPageSize(int pageSize)` method (default value is 1024).
216+
The results of the query are transferred to the client page by page. Each page contains a specific number of entries and is fetched to the client only when the entries from a page are requested. To change the number of entries in a page, use the `ScanQuery.setPageSize(int pageSize)` method (default value is 1024).
215217

216218
[source, java]
217219
-------------------------------------------------------------------------------

0 commit comments

Comments
 (0)