You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by na...@apache.org on 2021/03/02 21:38:23 UTC
[ignite-extensions] branch master updated: IGNITE-14264 Fixes cache
creation by IgniteClientSpringCacheManager with invalid name. (#48)
This is an automated email from the ASF dual-hosted git repository.
namelchev pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite-extensions.git
The following commit(s) were added to refs/heads/master by this push:
new 1844edc IGNITE-14264 Fixes cache creation by IgniteClientSpringCacheManager with invalid name. (#48)
1844edc is described below
commit 1844edcea035b6d3c0e5a55836abb39a0ae7a378
Author: Mikhail Petrov <32...@users.noreply.github.com>
AuthorDate: Wed Mar 3 00:37:58 2021 +0300
IGNITE-14264 Fixes cache creation by IgniteClientSpringCacheManager with invalid name. (#48)
---
modules/spring-cache-ext/README.txt | 5 +++++
.../ignite/cache/spring/IgniteClientSpringCacheManager.java | 11 +++++++----
2 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/modules/spring-cache-ext/README.txt b/modules/spring-cache-ext/README.txt
index 85cb178..04eaedc 100644
--- a/modules/spring-cache-ext/README.txt
+++ b/modules/spring-cache-ext/README.txt
@@ -3,6 +3,11 @@ Apache Ignite Spring Cache Module
Apache Ignite Spring Cache extension provides an integration with Spring Cache framework.
+There are two implementations of Apache Ignite Spring Cache Manager - org.apache.ignite.cache.spring.SpringCacheManager and
+org.apache.ignite.cache.spring.IgniteClientSpringCacheManager, that provide ability to use the Ignite thick or thin client to
+connect to the Ignite cluster and manage Ignite caches, respectively. Note, that org.apache.ignite.cache.spring.IgniteClientSpringCacheManager
+can be used only with Ignite since 2.11.0 version.
+
Importing Spring Cache extension In Maven Project
----------------------------------------
diff --git a/modules/spring-cache-ext/src/main/java/org/apache/ignite/cache/spring/IgniteClientSpringCacheManager.java b/modules/spring-cache-ext/src/main/java/org/apache/ignite/cache/spring/IgniteClientSpringCacheManager.java
index ab39040..317458f 100644
--- a/modules/spring-cache-ext/src/main/java/org/apache/ignite/cache/spring/IgniteClientSpringCacheManager.java
+++ b/modules/spring-cache-ext/src/main/java/org/apache/ignite/cache/spring/IgniteClientSpringCacheManager.java
@@ -36,6 +36,8 @@ import org.springframework.context.event.ContextRefreshedEvent;
* set before manager use (see {@link #setClientInstance(IgniteClient),
* {@link #setClientConfiguration(ClientConfiguration)}}).
*
+ * Note that current manager implementation can be used only with Ignite since 2.11.0 version.
+ * For Ignite versions earlier than 2.11.0 use an {@link SpringCacheManager}.
*
* Note that Spring Cache synchronous mode ({@link Cacheable#sync}) is not supported by the current manager
* implementation. Instead, use an {@link SpringCacheManager} that uses an Ignite thick client to connect to Ignite cluster.
@@ -148,8 +150,7 @@ public class IgniteClientSpringCacheManager extends AbstractCacheManager impleme
/** Gets dynamic Ignite cache configuration template. */
public ClientCacheConfiguration getDynamicCacheConfiguration() {
- // To avoid copying the dynamic cache configuration each time as we only change its name.
- return dynamicCacheCfg == null ? null : dynamicCacheCfg.setName(null);
+ return dynamicCacheCfg;
}
/**
@@ -164,8 +165,10 @@ public class IgniteClientSpringCacheManager extends AbstractCacheManager impleme
}
/** {@inheritDoc} */
- @Override protected synchronized SpringCache createCache(String name) {
- ClientCacheConfiguration ccfg = dynamicCacheCfg == null ? new ClientCacheConfiguration() : dynamicCacheCfg;
+ @Override protected SpringCache createCache(String name) {
+ ClientCacheConfiguration ccfg = dynamicCacheCfg == null
+ ? new ClientCacheConfiguration()
+ : new ClientCacheConfiguration(dynamicCacheCfg);
ClientCache<Object, Object> cache = cli.getOrCreateCache(ccfg.setName(name));