Skip to content

Commit

Permalink
#ignite-268: onUndeploy should be called one time for each cache.
Browse files Browse the repository at this point in the history
  • Loading branch information
ivasilinets committed Feb 16, 2015
1 parent bbf5163 commit 156e0c1
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 19 deletions.
Expand Up @@ -1211,7 +1211,7 @@ private boolean poke0(K key, @Nullable V newVal) throws IgniteCheckedException {
* @param ldr Class loader to undeploy.
*/
public void onUndeploy(ClassLoader ldr) {
ctx.deploy().onUndeploy(ldr);
ctx.deploy().onUndeploy(ldr, context());
}

/** {@inheritDoc} */
Expand Down
Expand Up @@ -205,35 +205,32 @@ public void unwind(GridCacheContext ctx) {
* Undeploys given class loader.
*
* @param ldr Class loader to undeploy.
* @param ctx Grid cache context.
*/
public void onUndeploy(final ClassLoader ldr) {
public void onUndeploy(final ClassLoader ldr, final GridCacheContext<K, V> ctx) {
assert ldr != null;

if (log.isDebugEnabled())
log.debug("Received onUndeploy() request [ldr=" + ldr + ", cctx=" + cctx + ']');

synchronized (undeploys) {
for (final GridCacheContext<K, V> cacheCtx : cctx.cacheContexts()) {
List<CA> queue = undeploys.get(cacheCtx.name());
List<CA> queue = undeploys.get(ctx.name());

if (queue == null)
undeploys.put(cacheCtx.name(), queue = new ArrayList<>());
if (queue == null)
undeploys.put(ctx.name(), queue = new ArrayList<>());

queue.add(new CA() {
@Override
public void apply() {
onUndeploy0(ldr, cacheCtx);
}
});
}
queue.add(new CA() {
@Override
public void apply() {
onUndeploy0(ldr, ctx);
}
});
}

for (GridCacheContext<K, V> cacheCtx : cctx.cacheContexts()) {
// Unwind immediately for local and replicate caches.
// We go through preloader for proper synchronization.
if (cacheCtx.isLocal())
cacheCtx.preloader().unwindUndeploys();
}
// Unwind immediately for local and replicate caches.
// We go through preloader for proper synchronization.
if (ctx.isLocal())
ctx.preloader().unwindUndeploys();
}

/**
Expand Down

0 comments on commit 156e0c1

Please sign in to comment.