You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by ak...@apache.org on 2015/02/02 15:53:00 UTC
[17/31] incubator-ignite git commit: #IGNITE-86: Change undeploys
from concurrentMap to Map
#IGNITE-86: Change undeploys from concurrentMap to Map
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/4b690fc4
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/4b690fc4
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/4b690fc4
Branch: refs/heads/ignite-32
Commit: 4b690fc4217e26a27f7385f1c3ecb0b006e9eb15
Parents: fb37ccf
Author: ivasilinets <iv...@gridgain.com>
Authored: Tue Jan 27 15:56:35 2015 +0300
Committer: ivasilinets <iv...@gridgain.com>
Committed: Tue Jan 27 15:56:35 2015 +0300
----------------------------------------------------------------------
.../cache/GridCacheDeploymentManager.java | 31 +++++++++++++-------
1 file changed, 21 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4b690fc4/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 8729b86..fa0f65f 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
@@ -53,7 +53,7 @@ public class GridCacheDeploymentManager<K, V> extends GridCacheSharedManagerAdap
private volatile ClassLoader globalLdr;
/** Undeploys. */
- private final ConcurrentMap<String, ConcurrentLinkedQueue<CA>> undeploys = new ConcurrentHashMap8<>();
+ private final Map<String, List<CA>> undeploys = new HashMap<>();
/** Per-thread deployment context. */
private ConcurrentMap<IgniteUuid, CachedDeploymentInfo<K, V>> deps = new ConcurrentHashMap8<>();
@@ -182,12 +182,16 @@ public class GridCacheDeploymentManager<K, V> extends GridCacheSharedManagerAdap
public void unwind(GridCacheContext ctx) {
int cnt = 0;
- ConcurrentLinkedQueue<CA> q = undeploys.get(ctx.namexx());
+ List<CA> q;
+
+ synchronized (undeploys) {
+ q = undeploys.remove(ctx.namexx());
+ }
if (q == null)
return;
- for (CA c = q.poll(); c != null; c = q.poll()) {
+ for (CA c : q) {
c.apply();
cnt++;
@@ -209,14 +213,21 @@ public class GridCacheDeploymentManager<K, V> extends GridCacheSharedManagerAdap
log.debug("Received onUndeploy() request [ldr=" + ldr + ", cctx=" + cctx + ']');
for (final GridCacheContext<K, V> cacheCtx : cctx.cacheContexts()) {
- undeploys.putIfAbsent(cacheCtx.namexx(), new ConcurrentLinkedQueue<CA>());
+ synchronized (undeploys) {
+ List<CA> queue = new ArrayList<>();
- undeploys.get(cacheCtx.namexx()).add(new CA() {
- @Override
- public void apply() {
- onUndeploy0(ldr, cacheCtx);
- }
- });
+ if (undeploys.containsKey(cacheCtx.namexx()))
+ queue = undeploys.get(cacheCtx.namexx());
+ else
+ undeploys.put(cacheCtx.namexx(), queue);
+
+ queue.add(new CA() {
+ @Override
+ public void apply() {
+ onUndeploy0(ldr, cacheCtx);
+ }
+ });
+ }
}
for (GridCacheContext<K, V> cacheCtx : cctx.cacheContexts()) {