Return-Path: X-Original-To: apmail-ignite-commits-archive@minotaur.apache.org Delivered-To: apmail-ignite-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 23F80175C7 for ; Wed, 8 Apr 2015 10:13:33 +0000 (UTC) Received: (qmail 89326 invoked by uid 500); 8 Apr 2015 10:13:33 -0000 Delivered-To: apmail-ignite-commits-archive@ignite.apache.org Received: (qmail 89256 invoked by uid 500); 8 Apr 2015 10:13:33 -0000 Mailing-List: contact commits-help@ignite.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ignite.incubator.apache.org Delivered-To: mailing list commits@ignite.incubator.apache.org Received: (qmail 89129 invoked by uid 99); 8 Apr 2015 10:13:33 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 08 Apr 2015 10:13:32 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED,T_RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO mail.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with SMTP; Wed, 08 Apr 2015 10:13:30 +0000 Received: (qmail 88270 invoked by uid 99); 8 Apr 2015 10:13:10 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 08 Apr 2015 10:13:10 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id C8BB7E2F2B; Wed, 8 Apr 2015 10:13:09 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: sergi@apache.org To: commits@ignite.incubator.apache.org Date: Wed, 08 Apr 2015 10:13:15 -0000 Message-Id: In-Reply-To: <0858702b01094ad1a881d609df428092@git.apache.org> References: <0858702b01094ad1a881d609df428092@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [07/24] incubator-ignite git commit: # ignite-680 X-Virus-Checked: Checked by ClamAV on apache.org # ignite-680 Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/86f23de5 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/86f23de5 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/86f23de5 Branch: refs/heads/ignite-624 Commit: 86f23de5cf8b308c25072e46cd3efdc31e9eb545 Parents: bf7fdb2 Author: sboikov Authored: Tue Apr 7 06:14:46 2015 +0300 Committer: sboikov Committed: Tue Apr 7 06:14:46 2015 +0300 ---------------------------------------------------------------------- .../processors/cache/GridCacheProcessor.java | 63 +++++++++++++++++++- 1 file changed, 62 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/86f23de5/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java index 7deb9fb..ca3b896 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java @@ -942,7 +942,7 @@ public class GridCacheProcessor extends GridProcessorAdapter { ctx.kernalContext().continuous().onCacheStop(ctx); U.stopLifecycleAware(log, lifecycleAwares(cache.configuration(), ctx.jta().tmLookup(), - ctx.store().configuredStore())); + ctx.store().configuredStore())); if (log.isInfoEnabled()) log.info("Stopped cache: " + cache.name()); @@ -2442,6 +2442,16 @@ public class GridCacheProcessor extends GridProcessorAdapter { private void addCacheConfigurations(Collection cfgs) throws IgniteCheckedException { GridCacheAdapter utilityCache = utilityCache(); + TemplateConfigurations templates = + utilityCache.localPeek(new CacheTemplateConfigurationKey(), CachePeekModes.ONHEAP_ONLY, null); + + if (templates != null) { + cfgs = templates.needAdd(cfgs); + + if (cfgs == null) + return; + } + final int RETRY_CNT = 5; for (int i = 0; i < RETRY_CNT; i++) { @@ -2766,6 +2776,57 @@ public class GridCacheProcessor extends GridProcessorAdapter { } /** + * Checks if need to add new templates. + * + * @param cfgs Templates to add. + * @return Templates which should be added. + */ + @Nullable Collection needAdd(Collection cfgs) { + Collection res = null; + + for (CacheConfiguration cfg : cfgs) { + boolean found = false; + + if (cfg.getName() != null && cfg.getName().endsWith("*")) { + String name0 = cfg.getName().substring(0, cfg.getName().length() - 1); + + if (wildcardNameCfgs != null) { + for (CacheConfiguration cfg0 : wildcardNameCfgs) { + if (F.eq(cfg0.getName(), name0)) { + found = true; + + break; + } + } + } + } + else { + if (exactNameCfgs != null) { + for (CacheConfiguration cfg0 : exactNameCfgs) { + if (F.eq(cfg0.getName(), cfg.getName())) { + found = true; + + break; + } + } + } + } + + if (!found) { + if (res == null) + res = new ArrayList<>(); + + System.out.println(Thread.currentThread().getName() + " need add: " + cfg + " " + exactNameCfgs); + + + res.add(cfg); + } + } + + return res; + } + + /** * @param cfgs Configurations to add. */ void add(Collection cfgs) {