You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sb...@apache.org on 2015/04/08 11:17:14 UTC
[03/16] incubator-ignite git commit: # ignite-680
# 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-694
Commit: 86f23de5cf8b308c25072e46cd3efdc31e9eb545
Parents: bf7fdb2
Author: sboikov <se...@inria.fr>
Authored: Tue Apr 7 06:14:46 2015 +0300
Committer: sboikov <se...@inria.fr>
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<CacheConfiguration> cfgs) throws IgniteCheckedException {
GridCacheAdapter<CacheTemplateConfigurationKey, TemplateConfigurations> 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<CacheConfiguration> needAdd(Collection<CacheConfiguration> cfgs) {
+ Collection<CacheConfiguration> 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<CacheConfiguration> cfgs) {