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. * @param ldr Class loader to undeploy.
*/ */
public void onUndeploy(ClassLoader ldr) { public void onUndeploy(ClassLoader ldr) {
ctx.deploy().onUndeploy(ldr); ctx.deploy().onUndeploy(ldr, context());
} }


/** {@inheritDoc} */ /** {@inheritDoc} */
Expand Down
Expand Up @@ -205,35 +205,32 @@ public void unwind(GridCacheContext ctx) {
* Undeploys given class loader. * Undeploys given class loader.
* *
* @param ldr Class loader to undeploy. * @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; assert ldr != null;


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


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


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


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


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


/** /**
Expand Down

0 comments on commit 156e0c1

Please sign in to comment.