Skip to content

Commit

Permalink
#ignite-51: fix GridCacheDeploymentSelfTest.
Browse files Browse the repository at this point in the history
  • Loading branch information
ivasilinets committed Mar 8, 2015
1 parent bd83393 commit 25b7c8a
Showing 1 changed file with 11 additions and 27 deletions.
Expand Up @@ -240,24 +240,26 @@ public void apply() {
private void onUndeploy0(final ClassLoader ldr, final GridCacheContext<K, V> cacheCtx) {
GridCacheAdapter<K, V> cache = cacheCtx.cache();

Collection<KeyCacheObject> keys = new ArrayList<>();
Collection<K> keys = new ArrayList<>();

for (GridCacheEntryEx e : cache.entries()) {
for (Cache.Entry<K, V> e : cache.entrySet()) {
boolean undeploy = cacheCtx.isNear() ?
undeploy(ldr, e, cacheCtx.near()) || undeploy(ldr, e, cacheCtx.near().dht()) :
undeploy(ldr, e, cacheCtx.cache());

if (undeploy)
keys.add(e.key());
keys.add(e.getKey());
}

if (log.isDebugEnabled())
log.debug("Finished searching keys for undeploy [keysCnt=" + keys.size() + ']');

cache.clearLocally(keys, true);
for (K k : keys)
cache.clearLocally(k);

if (cacheCtx.isNear())
cacheCtx.near().dht().clearLocally(keys, true);
for (K k : keys)
cacheCtx.near().dht().clearLocally(k);

GridCacheQueryManager<K, V> qryMgr = cacheCtx.queries();

Expand Down Expand Up @@ -293,31 +295,13 @@ private void onUndeploy0(final ClassLoader ldr, final GridCacheContext<K, V> cac
* @param cache Cache.
* @return {@code True} if need to undeploy.
*/
private boolean undeploy(ClassLoader ldr, GridCacheEntryEx e, GridCacheAdapter cache) {
KeyCacheObject key = e.key();

GridCacheEntryEx entry = cache.peekEx(key);

if (entry == null)
return false;

CacheObject v;

try {
v = entry.peek(GridCachePeekMode.GLOBAL, CU.empty0());
}
catch (GridCacheEntryRemovedException ignore) {
private boolean undeploy(ClassLoader ldr, Cache.Entry<K, V> e, GridCacheAdapter cache) {
if (e == null)
return false;
}
catch (IgniteException ignore) {
// Peek can throw runtime exception if unmarshalling failed.
return true;
}

assert key != null : "Key cannot be null for cache entry: " + e;
K key0 = e.getKey();

Object key0 = key.value(cache.context().cacheObjectContext(), false);
Object val0 = CU.value(v, cache.context(), false);
V val0 = e.getValue();

ClassLoader keyLdr = U.detectObjectClassLoader(key0);
ClassLoader valLdr = U.detectObjectClassLoader(val0);
Expand Down

0 comments on commit 25b7c8a

Please sign in to comment.