#IGNITE-50 Fixed review notes.

Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/de91e82f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/de91e82f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/de91e82f

Branch: refs/heads/ignite-189
Commit: de91e82fe8e95b8d26cd7cd4645ede18fec29093
Parents: 46a40dd
Author: nikolay_tikhonov <ntikho...@gridgain.com>
Authored: Thu Feb 12 17:18:04 2015 +0300
Committer: nikolay_tikhonov <ntikho...@gridgain.com>
Committed: Thu Feb 12 17:24:24 2015 +0300

----------------------------------------------------------------------
 .../configuration/IgniteConfiguration.java      |  2 +-
 .../cache/GridCacheDeploymentManager.java       | 17 +++++--------
 ...IgniteCacheAbstractExecutionContextTest.java | 22 +++++++++++++----
 .../tests/p2p/CacheDeploymentTestValue.java     |  2 +-
 .../apache/ignite/tests/p2p/CacheTestValue.java | 26 --------------------
 5 files changed, 25 insertions(+), 44 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/de91e82f/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java
 
b/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java
index 33c0448..95e0a0f 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/configuration/IgniteConfiguration.java
@@ -464,6 +464,7 @@ public class IgniteConfiguration {
         cacheCfg = cfg.getCacheConfiguration();
         cacheSanityCheckEnabled = cfg.isCacheSanityCheckEnabled();
         connectorCfg = cfg.getConnectorConfiguration();
+        classLdr = cfg.getClassLoader();
         clockSyncFreq = cfg.getClockSyncFrequency();
         clockSyncSamples = cfg.getClockSyncSamples();
         deployMode = cfg.getDeploymentMode();
@@ -520,7 +521,6 @@ public class IgniteConfiguration {
         userAttrs = cfg.getUserAttributes();
         waitForSegOnStart = cfg.isWaitForSegmentOnStart();
         warmupClos = cfg.getWarmupClosure();
-        classLdr = cfg.getClassLoader();
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/de91e82f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheDeploymentManager.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheDeploymentManager.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheDeploymentManager.java
index 9828328..12cd679 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheDeploymentManager.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheDeploymentManager.java
@@ -82,7 +82,7 @@ public class GridCacheDeploymentManager<K, V> extends 
GridCacheSharedManagerAdap
 
     /** {@inheritDoc} */
     @Override public void start0() throws IgniteCheckedException {
-        globalLdr = getCacheClassLoader();
+        globalLdr = new CacheClassLoader(cctx.gridConfig().getClassLoader());
 
         nodeFilter = new P1<ClusterNode>() {
             @Override public boolean apply(ClusterNode node) {
@@ -124,14 +124,6 @@ public class GridCacheDeploymentManager<K, V> extends 
GridCacheSharedManagerAdap
         }
     }
 
-    /**
-     * @return If user's class loader is null then will be used default class 
loader.
-     */
-    private CacheClassLoader getCacheClassLoader() {
-        return cctx.gridConfig().getClassLoader() == null ? new 
CacheClassLoader()
-            : new CacheClassLoader(cctx.gridConfig().getClassLoader());
-    }
-
     /** {@inheritDoc} */
     @Override protected void stop0(boolean cancel) {
         if (discoLsnr != null)
@@ -773,10 +765,13 @@ public class GridCacheDeploymentManager<K, V> extends 
GridCacheSharedManagerAdap
         }
 
         /**
-         * Sets context class loader as user's class loader.
+         * Sets context class loader.
+         * If user's class loader is null then will be used default class 
loader.
+         *
+         * @param classLdr User's class loader.
          */
         private CacheClassLoader(ClassLoader classLdr) {
-            super(classLdr);
+            super(classLdr != null ? classLdr : 
U.detectClassLoader(GridCacheDeploymentManager.class));
 
             p2pExclude = 
cctx.gridConfig().getPeerClassLoadingLocalClassPathExclude();
         }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/de91e82f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/context/IgniteCacheAbstractExecutionContextTest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/context/IgniteCacheAbstractExecutionContextTest.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/context/IgniteCacheAbstractExecutionContextTest.java
index 141dd50..7575c7a 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/context/IgniteCacheAbstractExecutionContextTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/context/IgniteCacheAbstractExecutionContextTest.java
@@ -30,7 +30,10 @@ import java.net.*;
  */
 public abstract class IgniteCacheAbstractExecutionContextTest extends 
IgniteCacheAbstractTest {
     /** */
-    public static final String TEST_VALUE = 
"org.apache.ignite.tests.p2p.CacheTestValue";
+    public static final String TEST_VALUE = 
"org.apache.ignite.tests.p2p.CacheDeploymentTestValue";
+
+    /** */
+    public static final int ITER_CNT = 1000;
 
     /** {@inheritDoc} */
     @Override protected IgniteConfiguration getConfiguration(String gridName) 
throws Exception {
@@ -42,8 +45,17 @@ public abstract class 
IgniteCacheAbstractExecutionContextTest extends IgniteCach
     }
 
     /** {@inheritDoc} */
+    @Override protected CacheConfiguration cacheConfiguration(String gridName) 
throws Exception {
+        CacheConfiguration cacheConfiguration = 
super.cacheConfiguration(gridName);
+
+        cacheConfiguration.setBackups(1);
+
+        return cacheConfiguration;
+    }
+
+    /** {@inheritDoc} */
     @Override protected int gridCount() {
-        return 3;
+        return 2;
     }
 
     /**
@@ -56,11 +68,11 @@ public abstract class 
IgniteCacheAbstractExecutionContextTest extends IgniteCach
 
         IgniteCache<Object, Object> jcache = grid(0).jcache(null);
 
-        for (int i = 0; i < 1000; i++)
+        for (int i = 0; i < ITER_CNT; i++)
             jcache.put(i, val);
 
-        for (int i = 0; i < 1000; i++) {
-            int idx = i % 3;
+        for (int i = 0; i < ITER_CNT; i++) {
+            int idx = i % gridCount();
 
             if (idx == 0)
                 assertEquals(jcache.get(i).getClass().getClassLoader(), 
testClassLdr);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/de91e82f/modules/extdata/p2p/src/main/java/org/apache/ignite/tests/p2p/CacheDeploymentTestValue.java
----------------------------------------------------------------------
diff --git 
a/modules/extdata/p2p/src/main/java/org/apache/ignite/tests/p2p/CacheDeploymentTestValue.java
 
b/modules/extdata/p2p/src/main/java/org/apache/ignite/tests/p2p/CacheDeploymentTestValue.java
index 8cffa89..e020525 100644
--- 
a/modules/extdata/p2p/src/main/java/org/apache/ignite/tests/p2p/CacheDeploymentTestValue.java
+++ 
b/modules/extdata/p2p/src/main/java/org/apache/ignite/tests/p2p/CacheDeploymentTestValue.java
@@ -20,7 +20,7 @@ package org.apache.ignite.tests.p2p;
 import java.io.*;
 
 /**
- * Value object for {@code GridCacheDeploymentSelfTest}.
+ * Value object for {@code GridCacheDeploymentSelfTest}, {@code 
IgniteCacheAbstractExecutionContextTest}.
  */
 public class CacheDeploymentTestValue implements Serializable {
     // No-op.

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/de91e82f/modules/extdata/p2p/src/main/java/org/apache/ignite/tests/p2p/CacheTestValue.java
----------------------------------------------------------------------
diff --git 
a/modules/extdata/p2p/src/main/java/org/apache/ignite/tests/p2p/CacheTestValue.java
 
b/modules/extdata/p2p/src/main/java/org/apache/ignite/tests/p2p/CacheTestValue.java
deleted file mode 100644
index 827cccd..0000000
--- 
a/modules/extdata/p2p/src/main/java/org/apache/ignite/tests/p2p/CacheTestValue.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.tests.p2p;
-
-import java.io.Serializable;
-
-/**
- * Value object for {@code IgniteCacheAbstractExecutionContextTest}.
- */
-public class CacheTestValue implements Serializable {
-}

Reply via email to