Skip to content

Commit

Permalink
#IGNITE-50 Fixed review notes.
Browse files Browse the repository at this point in the history
  • Loading branch information
niktikhonov committed Feb 12, 2015
1 parent 46a40dd commit de91e82
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 44 deletions.
Expand Up @@ -464,6 +464,7 @@ public IgniteConfiguration(IgniteConfiguration cfg) {
cacheCfg = cfg.getCacheConfiguration();
cacheSanityCheckEnabled = cfg.isCacheSanityCheckEnabled();
connectorCfg = cfg.getConnectorConfiguration();
classLdr = cfg.getClassLoader();
clockSyncFreq = cfg.getClockSyncFrequency();
clockSyncSamples = cfg.getClockSyncSamples();
deployMode = cfg.getDeploymentMode();
Expand Down Expand Up @@ -520,7 +521,6 @@ public IgniteConfiguration(IgniteConfiguration cfg) {
userAttrs = cfg.getUserAttributes();
waitForSegOnStart = cfg.isWaitForSegmentOnStart();
warmupClos = cfg.getWarmupClosure();
classLdr = cfg.getClassLoader();
}

/**
Expand Down
Expand Up @@ -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) {
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -773,10 +765,13 @@ private CacheClassLoader() {
}

/**
* 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();
}
Expand Down
Expand Up @@ -30,7 +30,10 @@
*/
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 {
Expand All @@ -41,9 +44,18 @@ public abstract class IgniteCacheAbstractExecutionContextTest extends IgniteCach
return cfg;
}

/** {@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;
}

/**
Expand All @@ -56,11 +68,11 @@ public void testUsersClassLoader() throws Exception {

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);
Expand Down
Expand Up @@ -20,7 +20,7 @@
import java.io.*;

/**
* Value object for {@code GridCacheDeploymentSelfTest}.
* Value object for {@code GridCacheDeploymentSelfTest}, {@code IgniteCacheAbstractExecutionContextTest}.
*/
public class CacheDeploymentTestValue implements Serializable {
// No-op.
Expand Down

This file was deleted.

0 comments on commit de91e82

Please sign in to comment.